- 积分
- 0
- 注册时间
- 2014-8-30
- 仿真币
-
- 最后登录
- 1970-1-1
|
程序代码如下:
function xht
global q m b e
q=1.6e-2;
m=0.02;
b=[2;1;0];
e=[1;0;1];
figure
strd{1}='e\neq 0,b\neq 0';
strd{2}='e=0,b\neq 0';
strd{3}='e\neq 0, b=0';
for i=1:3
[t,w]=ode23(@ddlzfun,[0:0.01:20],[0,0.01,0,6,0,0.01],[ ],q,m,b(i),e(i));
axes ('unit','normalized','position', [0.045+(i-1)*0.35 0.062 0.2786 0.6583 ]);
plot3(w(:,1),w(:,3),w(:,5),'linewidth',2);
grid on
title(strd{i},'fontsize',12,'fontweight','demi');
xlabel('x');
ylabel('y');
zlabel('z');
view([-51,18]);
end
function wdot=ddlzfun(t,w,q,m,b,e)
%该函数实现(3)式的差分迭代
syms q m b e
q=1.6e-2;
m=0.02;
b=[2;1;0];
e=[1;0;1];
wdot=[w(2); q.*b.*w(4)./m;w(4); q.*e./m- q.*b.*w(2)./m; w(6); 0];
执行报错:
??? Error using ==> funfun\private\odearguments
Solving DDLZFUN requires an initial condition vector of length 10.
Error in ==> ode23 at 172
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, ...
Error in ==> xht at 13
[t,w]=ode23(@ddlzfun,[0:0.01:20],[0,0.01,0,6,0,0.01],[ ],q,m,b(i),e(i));
|
|