|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
function xdot=wf(t,x)
syms x y z u v
a='-1.5*x-x^5*y-2*x*y*z-x*y';
da(1)=diff(a,x);
da(2)=diff(a,y);
da(3)=diff(a,z);
q=x^6+2*x^2*z+x^2-0.001*y+(u-a)^2*((1+(da(1))^2)*(2*z+1)+(x^2+u^2)^2+((da(1))*x^2)^2);
g=-2*(u-a)+(da(1))*u+0.5*(da(2))*q+(da(3))*z-y*(u-a)*(1+(da(1))^2)*(2*z+1)-y*(u-a)*((x^2+u^2)^2+((da(1))^2*x^2)^2);
%dx/dt=u+x^2*sin(2*x)+2*v*sin(x)+0.5*x*sint
%dy/dt=0.5*q
%dz/dt=-z+x^4+0.625
%du/dt=g+5*x+(6*u^2)/(1+2*x^2)+(1-cosu)*v+0.5*x*cost
%dv/dt=-v+x^2+0.5
x=zeros(5,1)
dx(1)=x(4)+x(1)^2*sin(2*x(1))+2*x(5)*sin(x(1))+0.5*x(1)*sint;
dx(2)=0.5*q;
dx(3)=-x(3)+x(1)^4+0.625;
dx(4)=g+5*x(1)+(6*x(4)^2)/(1+2*x(1)^2)+(1-cosx(4))*x(5)+0.5*x(1)*cost;
dx(5)=-x(5)+x(1)^2+0.5;
t0=0;tf=2;x0=[1,1,1,1,1]';
[t,x]=ode23('wf',t0,tf,x0);
plot(t,x);
figure(2)
plot(x(:,1))
为什么会出现这样的错误:Input argument "TotalBits" is undefined.
之后把sint,cost去掉后,
错误为:The following error occurred converting from sym to double:
Error using ==> sym.double
DOUBLE cannot convert the input expression into a double array.
If the input expression contains a symbolic variable, use the VPA function instead.
谢谢! |
|