[T,Y]=ode45(@rigid,[0 1],[rand(15,1)]);
plot(T,Y(:,1),'-',T,Y(:,2),'-.',T,Y(:,3),'.',T,Y(:,4),'-',T,Y(:,5),'-.',T,Y(:,6),'.',T,Y(:,7),'-',T,Y(:,8),'-.',T,Y(:,9),'.',T,Y(:,10),'-',T,Y(:,11),'-.',T,Y(:,12),'-.',T,Y(:,13),'.',T,Y(:,14),'-',T,Y(:,15),'.')
M文件:
function dy=rigid(t,y)
c=0.1;
Dy=rand(15,1);
A=[-2 1 1 0 0;
0 -2 1 1 0;
0 0 -2 0 0;
1 1 0 -2 0;
0 0 0 0 0];
for i=1:5
s1=0;
s2=0;
s3=0;
for j=1:5
s1=s1+A(i,j)*y(3*i-2);
s2=s2+A(i,j)*y(3*i-1);
s3=s3+A(i,j)*y(3*i);
end
Dy(3*i-2)= 10*y(3*i-1)-y(3*i-2)+c*s1;
Dy(3*i-1)= 28*y(3*i-2)-y(3*i-1)-y(3*i-2)*y(3*i)+c*s2;
Dy(3*i)= y(3*i-2)*y(3*i-1)-8/3*y(3*i)+c*s3;
end
运行后出现错误:
One or more output arguments not assigned during call to 'C:\MATLAB7\work\rigid.m (rigid)'.
Error in ==> funfun\private\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,...
人气:127 ℃ 时间:2020-06-20 01:50:57
解答
function dy=rigid(t,y) 中是dy下面用的是Dy,不统一.
推荐
- Most people want to work,but it has become more difficult in today's world to find work for everybody.The economy(经济)of
- Most people want to work,but it has become more difficult in today's world to find work for everybo
- Work work and more
- To work or to learn More作文 要求:1.some begin to work after graduating from college,because.
- to work or to learn more 英语作文怎么写
- 海轮在太平洋上行驶,船员连续过了两个元旦,这是由于该船在航行中( )
- 龟、兔2000赛跑,龟25米/分,兔320米/分.兔自以为比龟跑得快,就在途中睡一觉,结果龟比兔提前1.25分钟到达终点.求兔在途中睡了多少分钟
- 含有两个比喻的成语,急只写五个
猜你喜欢
- 修一条路,己经修了二分之一千米,占总长的三分之一,求这条路有�
- 已知a b是方程lg^2x-2lgx-2=0的两根,求log以a为底b的对数+log以b为底a的对数的值
- the hospital can p____ the best possible medical care
- love同义词是什么?
- 国家一级保护动物野生丹顶鹤,2001年全世界约有2000只,我国占其中的1/4,其它国家约有多少只?
- 写两句有关观察的名言警句
- 1under,isn't,baseball,bed,your,the2the,under,what,chair,is.连接成句子
- 如图3,梯形ABCD中,AB