| 查看: 758 | 回复: 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('状态量x_{1}','状态量x_{1}的估计') figure plot(t,e1) xlabel('t'); ylabel('状态量x_{1}与其估计量的误差e_{1}') figure plot(t,x(:,2),'r*',t,x(:,6),'o') xlabel('t') legend('状态量x_{2}','状态量x_{2}的估计') figure plot(t,e2) xlabel('t') ylabel('状态量x_{2}与其估计量的误差e_{2}') figure plot(t,x(:,3),'r*',t,x(:,7),'o') xlabel('t') legend('状态量x_{3}','状态量x_{3}的估计') figure plot(t,e3) xlabel('t'); ylabel('状态量x_{3}与其估计量的误差e_{3}') figure plot(t,x(:,4),'r*',t,x(:,8),'o') xlabel('t') legend('状态量x_{4}','状态量x_{4}的估计') figure plot(t,e4) xlabel('t'); ylabel('状态量x_{4}与其估计量的误差e_{4}') 执行第二个程序后,出现如下错误: ??? 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, ... 应该怎么改? |
» 猜你喜欢
有没有人能给点建议
已经有5人回复
假如你的研究生提出不合理要求
已经有12人回复
实验室接单子
已经有7人回复
全日制(定向)博士
已经有5人回复
萌生出自己或许不适合搞科研的想法,现在跑or等等看?
已经有4人回复
Materials Today Chemistry审稿周期
已经有4人回复
参与限项
已经有3人回复
对氯苯硼酸纯化
已经有3人回复
所感
已经有4人回复
要不要辞职读博?
已经有7人回复
» 本主题相关价值贴推荐,对您同样有帮助:
总氮测定中,标准曲线吸光值中一个数值偏小的问题及其他问题~
已经有4人回复
发现Matlab中一个有趣的现象
已经有4人回复
【求助】求助fortran中一个调用文件的问题
已经有3人回复
月只蓝
主管区长 (职业作家)
-

专家经验: +1059 - 应助: 1712 (讲师)
- 贵宾: 8.888
- 金币: 68123.7
- 散金: 1938
- 红花: 443
- 沙发: 4
- 帖子: 4373
- 在线: 3291.4小时
- 虫号: 1122189
- 注册: 2010-10-14
- 专业: 宇宙学
- 管辖: 计算模拟区

2楼2013-07-03 11:34:34
3楼2013-07-03 12:16:32
Nonebull
木虫 (正式写手)
- 应助: 13 (小学生)
- 金币: 5663.1
- 红花: 6
- 帖子: 463
- 在线: 306.9小时
- 虫号: 571775
- 注册: 2008-06-10
- 专业: 化学工程及工业化学
4楼2013-07-08 03:41:21
|
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楼2018-09-13 17:24:44












回复此楼