| 5 | 1/1 | 返回列表 |
| 查看: 6313 | 回復(fù): 9 | ||||
| 當前只顯示滿足指定條件的回帖,點擊這里查看本話題的所有回帖 | ||||
古道西風(fēng)11新蟲 (初入文壇)
|
[求助]
求助 用matlab擬合三元線性回歸方程及分析
|
|||
|
用matlab擬合三元線性回歸方程,我自己弄了一個如下 x1=[23.00 23.00 23.00 23.00 23.00 28.00 28.00 28.00 28.00 28.00]'; x2=[0.30 0.30 0.30 0.30 0.30 0.10 0.10 0.10 0.10 0.10]'; x3=[0.00 0.69 1.09 1.38 1.61 0.00 0.69 1.09 1.38 1.61]'; y=[-0.91 -0.35 -0.05 0.15 0.29 -0.58 -0.04 0.23 0.41 0.54]; x=[ones(10,1) x1 x2 x3]; >> [b,bint,r,rint,stats]=regress(y,x); ??? Error using ==> or Matrix dimensions must agree. Error in ==> regress at 70 wasnan = (isnan(y) | any(isnan(X),2)); >> b,bint,stats,rcoplot(r,rint) b = 0 -0.0115 -1.7878 0.6751 bint = 0 0 -0.0168 -0.0062 -2.2782 -1.2973 0.5701 0.7800 stats = 0.9747 134.6812 0.0000 0.0059 問題: 1.我編寫的程序?qū)幔?br /> 2.輸入程序中,總是會出現(xiàn)warning的那段文字,不知道怎么修改? |
|
本帖內(nèi)容被屏蔽 |
榮譽版主 (著名寫手)
彩色掛圖
![]() |
專家經(jīng)驗: +2 |

新蟲 (初入文壇)
|
請問y寫成列向量后又出現(xiàn)問題了,這是怎么回事?? >> x1=[23.00 23.00 23.00 23.00 23.00 28.00 28.00 28.00 28.00 28.00]'; x2=[0.30 0.30 0.30 0.30 0.30 0.10 0.10 0.10 0.10 0.10]'; x3=[0.00 0.69 1.09 1.38 1.61 0.00 0.69 1.09 1.38 1.61]'; >> y=[-0.91 -0.35 -0.05 0.15 0.29 -0.58 -0.04 0.23 0.41 0.54]; >> x=[ones(10,1) x1 x2 x3]; >> [b,bint,r,rint,stats]=regress(y,x); Warning: X is rank deficient to within machine precision. > In regress at 82 >> b,bint,stats,rcoplot(r,rint) |
榮譽版主 (著名寫手)
彩色掛圖
![]() |
專家經(jīng)驗: +2 |
|
Most likely you have too many predictor variables, and too few observations. As an alaogy, imagine trying to fit a cubic polynomial regression with only two observations. REGRESS will make a choise about which coefficients to set to zero, but it can't possibly know what you really want. 變量太多,你可以試一下,分別使用x(:,1:2), x(:,1:3), x(:,2:3)算一下,使用3列時總會出現(xiàn)一個b=0。 |

| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 085404 22408 315分 +5 | zhuangyan123 2026-03-31 | 6/300 |
|
|---|---|---|---|---|
|
[考研] 085600材料與化工329分求調(diào)劑 +5 | 這是有太陽哇 2026-03-25 | 5/250 |
|
|
[考研] 293分求調(diào)劑,外語為俄語 +5 | 加一一九 2026-03-31 | 5/250 |
|
|
[考研] 08工科求調(diào)劑286 +5 | tgs_001 2026-03-28 | 5/250 |
|
|
[考研] 309求調(diào)劑 +15 | 誰不是少年 2026-03-29 | 15/750 |
|
|
[考研] 295材料工程專碩求調(diào)劑 +10 | 1428151015 2026-03-27 | 10/500 |
|
|
[考研] 293求調(diào)劑 +3 | 末未mm 2026-03-30 | 5/250 |
|
|
[考研] 071010 323 分求調(diào)劑 +3 | Baekzhy 2026-03-27 | 3/150 |
|
|
[考研] 284求調(diào)劑 +14 | junqihahaha 2026-03-26 | 15/750 |
|
|
[考研] 348求調(diào)劑 +6 | 小懶蟲不懶了 2026-03-28 | 6/300 |
|
|
[考研] 318一志愿吉林大學(xué)生物與醫(yī)藥 求調(diào)劑 +5 | 篤行致遠. 2026-03-28 | 5/250 |
|
|
[考研] 275求調(diào)劑 +15 | Micky11223 2026-03-25 | 20/1000 |
|
|
[考研] 298求調(diào)劑 +3 | 種圣賜 2026-03-29 | 3/150 |
|
|
[考研] 0856材料化工調(diào)劑 總分330 +14 | zhubinhao 2026-03-27 | 14/700 |
|
|
[考研] 求調(diào)劑 +6 | 蘆lty 2026-03-25 | 7/350 |
|
|
[考研] 330一志愿中國海洋大學(xué) 化學(xué)工程 085602 有讀博意愿 求調(diào)劑 +3 | wywy.. 2026-03-27 | 4/200 |
|
|
[考研] 0856調(diào)劑 +5 | 求求讓我有書讀?/a> 2026-03-26 | 6/300 |
|
|
[考研] 314求調(diào)劑 +3 | 溪云珂 2026-03-26 | 3/150 |
|
|
[考研] 調(diào)劑 +3 | 李嘉圖·S·路 2026-03-27 | 3/150 |
|
|
[考研] 292求調(diào)劑 +4 | 求求了收下我吧?/a> 2026-03-26 | 4/200 |
|