| 5 | 1/1 | 返回列表 |
| 查看: 808 | 回復(fù): 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, ... 應(yīng)該怎么改? |
主管區(qū)長 (職業(yè)作家)
![]() |
專家經(jīng)驗: +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]); 您好,請問這個是怎么回事呀? |
| 5 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 348求調(diào)劑 +6 | 小懶蟲不懶了 2026-03-27 | 7/350 |
|
|---|---|---|---|---|
|
[考研] 286分調(diào)劑 +19 | Faune 2026-03-30 | 21/1050 |
|
|
[考研] 材料調(diào)劑 +12 | 一樣YWY 2026-04-01 | 12/600 |
|
|
[考研] 求調(diào)劑!生物與醫(yī)藥專碩 +3 | 逆轉(zhuǎn)陸先生 2026-04-01 | 3/150 |
|
|
[考研] 一志愿北交大材料工程,總分358 +4 | cs0106 2026-04-01 | 4/200 |
|
|
[考研] 265求調(diào)劑 +3 | 梁梁校校 2026-04-01 | 3/150 |
|
|
[考研] 275求調(diào)劑 +12 | waltzh 2026-04-01 | 12/600 |
|
|
[考研] 339求調(diào)劑,想調(diào)回江蘇 +7 | 烤麥芽 2026-03-27 | 10/500 |
|
|
[考研] 286求調(diào)劑 +16 | PolarBear11 2026-03-26 | 16/800 |
|
|
[考研] 0817化工學(xué)碩調(diào)劑 +11 | 努力上岸中! 2026-03-31 | 11/550 |
|
|
[考研] 290求調(diào)劑 +5 | dfffsar 2026-03-29 | 5/250 |
|
|
[考研] 0703一志愿南師大334求調(diào)劑 +4 | seven7yu 2026-03-30 | 4/200 |
|
|
[考研] 08工科275求調(diào)劑,可跨考。 +5 | AaAa7420 2026-03-31 | 5/250 |
|
|
[考研] 一志愿 南京航空航天大學(xué) ,080500材料科學(xué)與工程學(xué)碩 +10 | @taotao 2026-03-31 | 11/550 |
|
|
[考研] 求調(diào)劑,一志愿北林食品與營養(yǎng)095500,301分,已過六級,有科研經(jīng)歷 +4 | 快樂儲蓄罐 2026-03-31 | 4/200 |
|
|
[考研] 考研生物與醫(yī)藥調(diào)劑 +7 | 鐵憨憨123425 2026-03-31 | 7/350 |
|
|
[考研] 一志愿南昌大學(xué)324求調(diào)劑 +6 | hanamiko 2026-03-29 | 6/300 |
|
|
[考研]
|
Gymno 2026-03-30 | 6/300 |
|
|
[考研] 11408總分309,一志愿東南大學(xué)求調(diào)劑,不挑專業(yè) +5 | 天賦帶到THU 2026-03-29 | 6/300 |
|
|
[考研] 071010 323 分求調(diào)劑 +3 | Baekzhy 2026-03-27 | 3/150 |
|