精華區beta MATLAB 關於我們 聯絡資訊
※ 引述《jerry134 (海都)》之銘言: : X =[ 0 0.2000 0.4000 0.6000 0.8000 1.0000 1.2000 1.4000 1.6000 1.8000 2.0000 2.2000 2.4000 2.6000 2.8000 3.0000 3.2000 3.4000 3.6000 3.8000 4.0000]; : Y=[ 0.6225 0.7309 0.7658 0.8555 0.8809 0.9341 0.9578 0.9600 0.9859 0.9837 0.9890 0.9926 0.9950 0.9967 0.9978 0.9985 0.9990 0.9993 0.9995 0.9995 0.9998] : 請問要怎麼畫出Y=EXP(a+bX)/(1+EXP(a+bX))這個圖呢?? 這個問題.好像是要求參數吧? = =a 大致上.先在 command window 鍵入 (請自行輸入.為求版面好閱讀 我把資料打成這種形式.只要長度相同即可) x= y= 0 0.6225 0.2000 0.7309 0.4000 0.7658 0.6000 0.8555 0.8000 0.8809 1.0000 0.9341 1.2000 0.9578 1.4000 0.9600 1.6000 0.9859 1.8000 0.9837 2.0000 0.9890 2.2000 0.9926 2.4000 0.9950 2.6000 0.9967 2.8000 0.9978 3.0000 0.9985 3.2000 0.9990 3.4000 0.9993 3.6000 0.9995 3.8000 0.9995 4.0000 0.9998 打開左下角的 start .選工具箱.裡面有 Curve Fitting Tool 要麼使用.在裡面的選項有 demo 選項.是教學的....可以自己現學現賣 我跑出來的結果為: General model: f(x) = exp(a+b.*x)./(1+exp(a+b.*x)) Coefficients (with 95% confidence bounds): a = 0.5108 (0.4526, 0.569) b = 2.012 (1.881, 2.144) Goodness of fit: SSE: 0.001281 R-square: 0.9943 Adjusted R-square: 0.994 RMSE: 0.00821 底下的 Goodness of fit 為 fit 出來的各種誤差值計算 而 a = 0.5108 b = 2.012 .在工具箱中.可以自行調整逼近上下限值 可以自行選擇為自然條件 (例如反應動力式次方為 1~2) ----------------------------------------------------------------------------- 另提.有版友有提到用 poly polyfit .但... poly(A) 是將多項式因式分解的式子.將多項式的係數以A來表示. 化成 (x-a1)(x-a2)...etc polyfit(x,y,n) n= 多項式最高次方數 - 1 (因為有常數項也算一項 要特別去注意) polyval(p,x) 則是 p 為多項式係數.而x為資料點.算出每一點的數值 本題是指數型的題目.且未知 a b 兩個參數. 不能用這幾個 -- Basic -> Advance -> Master -> Expert -> Great-Master Skill: AspenPlus AspenDynamic MATLAB Numerical-Method Level: Master Advance Expert Master -----------......什麼時候升級呢? 囧> -------------- Fortran Tecplot Sigmaplot Corldraw Basic Basic Basic Basic -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.118.160.163
muto52:我建議用nlinfit比較好用,適用於多個係數的非線性迴歸 10/12 23:08
gamer:curvefitting box也支援多系數的nonlinear curve fitting 10/13 02:08
gamer:也可以用customer equation。但是不適用於多變數。 10/13 02:09
gamer:多變數的話要用其他方式來處理 10/13 02:09