| 8 | 1/1 | 返回列表 |
| 查看: 1402 | 回復(fù): 7 | |||
wzycrfpxz新蟲 (初入文壇)
|
[求助]
matlab 問題求助,一段程序出錯,求糾錯
|
|
function dx=lunar(t,x,u) syms t x u; u0=45760.00; if ((x(6)/x(5))*cos(atan(x(7)/x(6)))+(x(7)/x(5))*sin(atan(x(7)/x(6)))-(3.283e-4)*x(10))+1>0 u=u0; else u=0.00; dx=[(u/x(5))*cos(atan(x(7)/x(6))); (u/x(5))*sin(atan(x(7)/x(6))); x(1); x(2); (-3.281e-4)*u; 0; -x(9); 0; 0; (u/x(5)^2)*cos(atan(x(7)/x(6)))*x(6)+(u/x(5)^2)*sin(atan(x(7)/x(6)))*x(7)]; end ??? Error using ==> mupadmex Error in MuPAD command: Index exceeds matrix dimensions. Error in ==> sym.sym>sym.subsref at 1366 B = mupadmex('mllib::subsref',A.s,inds{:}); Error in ==> lunar at 4 if ((x(6)/x(5))*cos(atan(x(7)/x(6)))+(x(7)/x(5))*sin(atan(x(7)/x(6)))-(3.283e-4)*x(10))+1>0 |
榮譽版主 (著名寫手)
彩色掛圖
![]() |
專家經(jīng)驗: +2 |

新蟲 (初入文壇)
榮譽版主 (著名寫手)
彩色掛圖
![]() |
專家經(jīng)驗: +2 |

榮譽版主 (著名寫手)
彩色掛圖
![]() |
專家經(jīng)驗: +2 |

新蟲 (初入文壇)
|
function dx=lunar(t,x) if ((x(6)/x(5))*cos(atan(x(7)/x(6)))+(x(7)/x(5))*sin(atan(x(7)/x(6)))-(3.283e-4)*x(10))+1>0 u=45760.00; else u=0.00 dx=[(u/x(5))*cos(atan(x(7)/x(6))); (u/x(5))*sin(atan(x(7)/x(6))); x(1); x(2); (-3.281e-4)*u; 0; -x(9); 0; 0; (u/x(5)^2)*cos(atan(x(7)/x(6)))*x(6)+(u/x(5)^2)*sin(atan(x(7)/x(6)))*x(7)]; end 命令窗口:x0=[150;-44;0;2300;9472.06;0.005;-0.003501;0;5.415e-4;1]; tic,[t,y]=ode45(@lunar,[0,100],x0);toc Error in ==> lunar at 3 if ((x(6)/x(5))*cos(atan(x(7)/x(6)))+(x(7)/x(5))*sin(atan(x(7)/x(6)))-(3.283e-4)*x(10))+1>0 ??? Error using ==> feval Output argument "dx" (and maybe others) not assigned during call to "C:\Users\Administrator\Documents\MATLAB\lunar.m>lunar". Error in ==> odearguments at 110 f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0. Error in ==> ode45 at 173 [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, .. |
榮譽版主 (著名寫手)
彩色掛圖
![]() |
專家經(jīng)驗: +2 |

新蟲 (初入文壇)
| 8 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 0703化學(xué)求調(diào)劑 總分331 +3 | ZY-05 2026-03-13 | 3/150 |
|
|---|---|---|---|---|
|
[考研] 334求調(diào)劑 +3 | 志存高遠意在機?/a> 2026-03-16 | 3/150 |
|
|
[考研] 326求調(diào)劑 +5 | 上岸的小葡 2026-03-15 | 6/300 |
|
|
[考研] 302求調(diào)劑 +9 | 負心者當誅 2026-03-11 | 9/450 |
|
|
[考博] 26申博 +4 | 八旬速覽 2026-03-16 | 4/200 |
|
|
[考研] 275求調(diào)劑 +4 | 太陽花天天開心 2026-03-16 | 4/200 |
|
|
[論文投稿] 有沒有大佬發(fā)小論文能帶我個二作 +3 | 增銳漏人 2026-03-17 | 4/200 |
|
|
[考研] 東南大學(xué)364求調(diào)劑 +5 | JasonYuiui 2026-03-15 | 5/250 |
|
|
[基金申請]
今年的國基金是打分制嗎?
50+3
|
zhanghaozhu 2026-03-14 | 3/150 |
|
|
[考研] 318求調(diào)劑 +3 | Yanyali 2026-03-15 | 3/150 |
|
|
[考研] 321求調(diào)劑 +5 | 大米飯! 2026-03-15 | 5/250 |
|
|
[考研] 311求調(diào)劑 +5 | 26研0 2026-03-15 | 5/250 |
|
|
[考研] 070303一志愿西北大學(xué)學(xué)碩310找調(diào)劑 +5 | d如愿上岸 2026-03-12 | 8/400 |
|
|
[考研] 0703 物理化學(xué)調(diào)劑 +3 | 我可以上岸的對?/a> 2026-03-13 | 5/250 |
|
|
[考研] 070305求調(diào)劑 +3 | mlpqaz03 2026-03-14 | 4/200 |
|
|
[考研] 中科大材料與化工319求調(diào)劑 +3 | 孟鑫材料 2026-03-14 | 3/150 |
|
|
[基金申請] 現(xiàn)在如何回避去年的某一個專家,不知道名字 +3 | zk200107 2026-03-12 | 6/300 |
|
|
[考研] 材料工程調(diào)劑 +9 | 咪咪空空 2026-03-12 | 9/450 |
|
|
[考研] 0856材料與化工301求調(diào)劑 +5 | 奕束光 2026-03-13 | 5/250 |
|
|
[考研] 一志愿西南交大,材料專碩317求調(diào)劑 +5 | lx8568 2026-03-11 | 5/250 |
|