|
步长随意选取(最好选整数)
function ff
options = odeset('RelTol',1e-5,'AbsTol',[1e-5 1e-5]);
sol= ode45(@ischao,[0 1000],[0 0],options); %[T,Y] =
step=7.5; %步长
x = 0:0.1:1000;
y1 = deval(sol,x,1);
y2 = deval(sol,x,2);
%plot(y1(100:step:end),y2(100:step:end),'*') %y1 vs y2
subplot(1,2,1)
plot(y1(1:step:end-step),y1(1+step:step:end),'*'); %y1(t-1) vs y1(t)
subplot(1,2,2)
plot(y2(1:step:end-step),y2(1+step:step:end),'*'); %y2(t-1) vs y2(t)
function dy = ischao(t,y)
dy = zeros(2,1); % a column vector
dy=[y(2);15.0*cos(1.0*t)-0.375*y(1)^3-y(1)+1.299*y(1)^2-0.0059*y(2)]; |
|