| 5 | 1/1 | 返回列表 |
| 查看: 809 | 回復(fù): 4 | |||
maggie0211新蟲 (小有名氣)
|
[求助]
matlab中一點(diǎn)小問題
|
|
程序如下: 第一個(gè): 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))] 第二個(gè): 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}的估計(jì)') figure plot(t,e1) xlabel('t'); ylabel('狀態(tài)量x_{1}與其估計(jì)量的誤差e_{1}') figure plot(t,x(:,2),'r*',t,x(:,6),'o') xlabel('t') legend('狀態(tài)量x_{2}','狀態(tài)量x_{2}的估計(jì)') figure plot(t,e2) xlabel('t') ylabel('狀態(tài)量x_{2}與其估計(jì)量的誤差e_{2}') figure plot(t,x(:,3),'r*',t,x(:,7),'o') xlabel('t') legend('狀態(tài)量x_{3}','狀態(tài)量x_{3}的估計(jì)') figure plot(t,e3) xlabel('t'); ylabel('狀態(tài)量x_{3}與其估計(jì)量的誤差e_{3}') figure plot(t,x(:,4),'r*',t,x(:,8),'o') xlabel('t') legend('狀態(tài)量x_{4}','狀態(tài)量x_{4}的估計(jì)') figure plot(t,e4) xlabel('t'); ylabel('狀態(tài)量x_{4}與其估計(jì)量的誤差e_{4}') 執(zhí)行第二個(gè)程序后,出現(xiàn)如下錯(cuò)誤: ??? 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, ... 應(yīng)該怎么改? |
主管區(qū)長(zhǎng) (職業(yè)作家)
![]() |
專家經(jīng)驗(yàn): +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) 出錯(cuò) ode45 (line 113) [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ... 出錯(cuò) event_trigger_ftb (line 10) [t,x] = ode45('xprim1',[0 9],[0.4;0.2]); 您好,請(qǐng)問這個(gè)是怎么回事呀? |
| 5 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 301求調(diào)劑 +3 | 細(xì)胞相關(guān)蛋白 2026-04-02 | 5/250 |
|
|---|---|---|---|---|
|
[考研] 342求調(diào)劑 +13 | Mary Keen 2026-03-28 | 14/700 |
|
|
[考研] 材料求調(diào)劑 一志愿哈工大總分298分,前三科223分 +12 | dongfang59 2026-03-27 | 12/600 |
|
|
[考研] 材料工程322分 +8 | 哈哈哈吼吼吼哈 2026-04-01 | 8/400 |
|
|
[考研] 求調(diào)劑!生物與醫(yī)藥專碩 +4 | 逆轉(zhuǎn)陸先生 2026-04-01 | 4/200 |
|
|
[考研] 085900土木水利336分求調(diào)劑 +4 | Zhangjiangj 2026-03-31 | 6/300 |
|
|
[考研] 266分,一志愿電氣工程,本科材料,求材料專業(yè)調(diào)劑 +10 | 哇呼哼呼哼 2026-04-01 | 11/550 |
|
|
[考研] 0805求調(diào)劑 +8 | 是水分 2026-03-31 | 8/400 |
|
|
[考研] 311求調(diào)劑 +16 | zchqwer 2026-04-01 | 18/900 |
|
|
[考研] 322求調(diào)劑 +5 | 熹僖XX 2026-03-31 | 6/300 |
|
|
[考研] 土木304求調(diào)劑 +6 | 兔突突突, 2026-03-31 | 7/350 |
|
|
[考研] 085602化學(xué)工程268分蹲調(diào)劑 +8 | 月照花林。 2026-04-01 | 8/400 |
|
|
[考研] 070300化學(xué)279求調(diào)劑 +15 | 哈哈哈^_^ 2026-03-31 | 17/850 |
|
|
[考研] 362求調(diào)劑 +13 | 西南交材料專碩3 2026-03-31 | 13/650 |
|
|
[考研] 318求調(diào)劑 +3 | 篤行致遠(yuǎn). 2026-03-31 | 3/150 |
|
|
[考研] 一志愿a區(qū)211,085601-307分求調(diào)劑 +10 | 黨嘉豪 2026-03-31 | 23/1150 |
|
|
[考研] 本2一志愿C9-333分,材料科學(xué)與工程,求調(diào)劑 +9 | 升升不降 2026-03-31 | 9/450 |
|
|
[考研] 085601英二數(shù)二求調(diào)劑 總分325 +4 | 余航航 2026-03-31 | 4/200 |
|
|
[考研] 一志愿華中師范化學(xué)332分求調(diào)劑 +3 | Lyy930824@ 2026-03-29 | 3/150 |
|
|
[考研] 081200-314 +3 | LILIQQ 2026-03-27 | 4/200 |
|