好的,其实我就是把工具箱的方程改了一下,其他的都没有动
这是程序:
%Rearrange input data in desired format
%Note: the input data is a column vector
x=X(1); y=X(2);z=X(3);
Q=[X(4),X(7),X(10);
X(5),X(8),X(11);
X(6),X(9),X(12)];
%Duffing's equation
dx=y;
dy=-3.8*x-0.5*(y+10*x^2*y)-5*x^3-2*10.2*cos(2*z)*(-x+x^3/6);
dz=2; %where z = t, this transformation is for changing
%the non-autonomous system to a autonomous one
DX1=[dx;dy;dz]; %Output data
%Linearized system
J=[ 0, 1, 0;
-3.8-10*x*y-15*x^2-2*10.2*cos(2*z)*(-1+x^2/2), -0.5-5*x^2, 4*10.2*sin(2*z)*(-x+x^3/6);
0, 0, 0];
%Variational equation
F=J*Q;
%Put output data in a column vector
OUT=[DX1;F(:)]; |