一元回歸分析MATLAB計算_第1頁
一元回歸分析MATLAB計算_第2頁
一元回歸分析MATLAB計算_第3頁
一元回歸分析MATLAB計算_第4頁
一元回歸分析MATLAB計算_第5頁
全文預(yù)覽已結(jié)束

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

ColumnsColumns1through13元回歸分析MATLAB的計算利用matlab計算一元回歸分析函數(shù)如下所示,根據(jù)試驗(yàn)數(shù)據(jù)x和y,可在matlab中利用一元擬合實(shí)現(xiàn)回歸直線的計算、相關(guān)系數(shù)計算、同時得出一個散點(diǎn)圖和回歸直線圖。Matlab程序代碼如下:>>x=[15.0,25.8,30.0,36.6,44.4]>>y=[39.4,42.9,41.0,43.1,49.2]>>n=1;>>p=polyfit(x,y,n)>>xi=linspace(15,45,100)>>z=polyval(p,xi)>>plot(x,y,'*b',xi,z,'r')x,y以數(shù)組的形式輸入擬合階數(shù)設(shè)置為1計算擬合系數(shù)a,b規(guī)定擬合曲線橫軸的分度虛擬出擬合曲線上的點(diǎn)畫出散點(diǎn)圖和回歸直線圖>>xlabel('x'),ylabel('y=0.2924x+34.2417'),legend(散點(diǎn)圖和回歸直線')具體程序和程序的執(zhí)行結(jié)果如下所示:>>x=[15.0,25.8,30.0,36.6,44.4]=15.000025.800030.000036.600044.4000>>y=[39.4,42.9,41.0,43.1,49.2]y=39.400042.900041.000043.100049.2000>>n=1;>>p=polyfit(x,y,n)p=0.292434.2417>>xi=linspace(15,45,100)=

15.000015.303015.606115.909116.212116.515216.818217.121217.424217.727318.030318.333318.6364Columns14through2618.939419.242419.545519.848520.151520.454520.757621.060621.363621.666721.969722.272722.5758Columns27through3922.878823.181823.484823.787924.090924.393924.697025.000025.303025.606125.909126.212126.5152Columns40through5226.818227.121227.424227.727328.030328.333328.636428.939429.242429.545529.848530.151530.4545Columns53through6530.757631.060631.363631.666731.969732.272732.575832.878833.181833.484833.787934.090934.3939Columns66through7834.697035.000035.303035.606135.909136.212136.515236.818237.121237.424237.727338.030338.3333Columns79through9138.636438.939439.242439.545539.848540.151540.454540.757641.060641.363641.666741.969742.2727Columns92through10042.575842.878843.181843.484843.787944.090944.393944.697045.0000>>z=polyval(p,xi)z=38.628238.716838.805538.894138.982739.071339.159939.248539.337239.425839.514439.603039.6916Columns14through2639.780239.868839.957540.046140.134740.223340.311940.400540.489240.577840.666440.755040.8436Columns27through3940.932241.020941.109541.198141.286741.375341.463941.552641.641241.729841.818441.907041.9956Columns40through5242.084342.172942.261542.350142.438742.527342.616042.704642.793242.881842.970443.059043.1476Columns53through6543.236343.324943.413543.502143.590743.679343.768043.856643.945244.033844.122444.211044.2997Columns66through7844.388344.476944.565544.654144.742744.831444.920045.008645.097245.185845.274445.363145.4517Columns79through9145.540345.628945.717545.806145.894845.983446.072046.160646.249246.337846.426446.515146.6037Columns92through10046.692346.780946.869546.958147.046847.135447.224047.312647.4012>>plot(x,y,'*b',xi,z,'r:')>>plot(x,y,'*b',xi,z,'r')>>xlabel('x'),ylabel('y=0.2924x+34.2417'),legend(散點(diǎn)圖和回歸直線')>>

散點(diǎn)圖:0.292434.24170.292434.2417妙MATLAB1?22]FileEditDebugDesktopWindowHelp碎呼逾CurrentDirectory:|C:)MATLAB7\work▼(|QShortcuts0HowtoAdd0What'sNew?x=[15.0,25.8,30.0,36.6,44.4];?y=[39.4,42.9,41.0,43.1,49.2];?n=l;?p=polyfit(x,y,n)xi=linspace(15,45,100)

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論