| 5 | 1/1 | 返回列表 |
| 查看: 811 | 回復: 4 | |||
| 當前只顯示滿足指定條件的回帖,點擊這里查看本話題的所有回帖 | |||
[求助]
matlab中一點小問題
|
|||
|
程序如下: 第一個: function dx=ax3(t,x) dx=[x(2) -48.6*x(1)-1.26*x(2)+48.6*x(3)+21.6*sin(x(2)) 10*x(4) 1.95*x(1)-1.95*x(3)-0.333*sin(x(1)) x(6)+5.1734*(x(1)-x(5))-5.0069*(x(2)-x(6)) -48.6*x(5)-1.26*x(6)+48.6*x(7)+21.6*sin(x(6))-4.3407*(x(1)-x(5)) -4.1015*(x(2)-x(6)) 10*x(8) 1.95*x(5)-1.95*x(7)-0.333*sin(x(5))+1.0759*(x(1)-x(5))+1.0166*(x(2)-x(6))] 第二個: tspan=[0 10]; x0=[1 2 1 0 1 2 0 0.5]'; [t,x]=ode15s(@ax3,tspan,x0); e1=x(:,1)-x(:,5); e2=x(:,2)-x(:,6); e3=x(:,3)-x(:,7); e4=x(:,4)-x(:,8); plot(t,x(:,1),'r*',t,x(:,5),'o') xlabel('t') legend('狀態(tài)量x_{1}','狀態(tài)量x_{1}的估計') figure plot(t,e1) xlabel('t'); ylabel('狀態(tài)量x_{1}與其估計量的誤差e_{1}') figure plot(t,x(:,2),'r*',t,x(:,6),'o') xlabel('t') legend('狀態(tài)量x_{2}','狀態(tài)量x_{2}的估計') figure plot(t,e2) xlabel('t') ylabel('狀態(tài)量x_{2}與其估計量的誤差e_{2}') figure plot(t,x(:,3),'r*',t,x(:,7),'o') xlabel('t') legend('狀態(tài)量x_{3}','狀態(tài)量x_{3}的估計') figure plot(t,e3) xlabel('t'); ylabel('狀態(tài)量x_{3}與其估計量的誤差e_{3}') figure plot(t,x(:,4),'r*',t,x(:,8),'o') xlabel('t') legend('狀態(tài)量x_{4}','狀態(tài)量x_{4}的估計') figure plot(t,e4) xlabel('t'); ylabel('狀態(tài)量x_{4}與其估計量的誤差e_{4}') 執(zhí)行第二個程序后,出現(xiàn)如下錯誤: ??? Error using ==> funfun\private\odearguments Solving AX3 requires an initial condition vector of length 4. Error in ==> ode15s at 228 [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ... 應該怎么改? |
木蟲 (正式寫手)
主管區(qū)長 (職業(yè)作家)
![]() |
專家經驗: +1059 |

|
function xprim= xprim1(t,x) global a b c d e f q w r v s g xprim =[(e*s+a)*x(1)+(e*g+b)*x(2)+q*0.3*sin(t)+w*0.1*cos(2*t);(f*s+c)*x(1)+(f*g+d)*x(2)+r*0.3*sin(t)+v*0.1*cos(2*t)]; clear;clc; global a b c d e f q w r v s g a = 0; b = 1; c = 4; d = 0; e = 0; f = 1; q = 1; w = 0; r = 0; v = 1; s = 1; g = 3; [t,x] = ode45('xprim1',[0 9],[0.4;0.2]); plot(t,x) 出錯 ode45 (line 113) [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ... 出錯 event_trigger_ftb (line 10) [t,x] = ode45('xprim1',[0 9],[0.4;0.2]); 您好,請問這個是怎么回事呀? |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 070305高分子化學與物理 304分求調劑 +15 | c297914 2026-03-28 | 15/750 |
|
|---|---|---|---|---|
|
[考研] 342求調劑 +14 | Mary Keen 2026-03-28 | 15/750 |
|
|
[考研] 環(huán)境工程297分求調劑一志愿杭高院 +15 | GENJIOW 2026-03-31 | 16/800 |
|
|
[考研] 282求調劑 +18 | ycy1201 2026-04-01 | 20/1000 |
|
|
[考研] 求調劑22408 288分 +4 | new382 2026-04-02 | 4/200 |
|
|
[考研] 材料專業(yè)求調劑 +10 | 月月鳥木 2026-04-01 | 10/500 |
|
|
[考研] 材料化工340求調劑 +5 | jhx777 2026-03-30 | 5/250 |
|
|
[考研] 材料求調劑 一志愿哈工大總分298分,前三科223分 +12 | dongfang59 2026-03-27 | 12/600 |
|
|
[考研] 求調劑推薦 +3 | 南山南@ 2026-04-01 | 3/150 |
|
|
[考研] 求調劑推薦 材料 304 +21 | 荷包蛋hyj 2026-03-26 | 21/1050 |
|
|
[考研] 材料專業(yè)調劑 +5 | 啦啦啦哭 2026-03-31 | 6/300 |
|
|
[考研] 英一數(shù)二生物信息學287分,本科生物科學,求調劑 +3 | 碧水xyz 2026-03-29 | 4/200 |
|
|
[考研] 求調劑:一志愿:南京大學 專業(yè):0705 總分320 ,本科985,四六級已過 +3 | lfy760306 2026-03-31 | 3/150 |
|
|
[考研] 375求調劑 +7 | 雨夏整夜 2026-03-29 | 7/350 |
|
|
[考研] 求化學調劑 +12 | wulanna 2026-03-28 | 12/600 |
|
|
[考研] 085600材料與化工調劑 +16 | kikiki7 2026-03-30 | 16/800 |
|
|
[考研] 085602 化學工程專碩 340分求調劑 +4 | qianbai11 2026-03-29 | 4/200 |
|
|
[考研] 一志愿雙一流機械285分求調劑 +4 | 幸運的三木 2026-03-29 | 5/250 |
|
|
[考研] 081200-314 +3 | LILIQQ 2026-03-27 | 4/200 |
|
|
[考研] 285求調劑 +4 | AZMK 2026-03-27 | 7/350 |
|