clear all
%数据的初始化
globalgamma omega f
function df=dafen(t,x)
global f2 walpha1 calpha3
df=[x(2);
-alpha1*x(1)-alpha3*x(1)^3+f2*cos(w*t)-c*x(2)];
end
clear all
close all
global f2 walpha1 calpha3
%%%%%%%%%%%%%%%%%%%%%%%
f2=0.35;
alpha1=1;
alpha3=-1
c=0.4;
w=0.8;
tic %% tic,toc用于计时
range=0.36;
k=0;
YY2=[];
for f2=range
period=2*pi/w; %
step=2*pi/500/w;%步长。
y0=;
k=k+1
tspan=;
=ode45(@dafen,tspan,y0);
nn =floor(length(Y)*0.9);
YY(k,:)=Y(nn:500:end,1);
end
% figure
%plot(range,YY,'k.','markersize',1);
figure
plot(Y(400000:end,1),Y(400000:end,2))
hold on
plot(Y(400000:500:end,1),Y(400000:500:end,2),'r.')
figure
plot(t(450000:end),Y(450000:end,1))
toc
楼主,帮忙给我看一下,用的你的初值但是还是出现警告
clear all
close all
global f2 walpha1 calpha3
f2=0.35;
alpha1=1;
alpha3=-1
c=0.4;
w=0.8;
tic %% tic,toc用于计时
%%%%%%%%%%%%8%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%range=7080%%%参数范围
range=0.35:0.001:0.39;
k=0;
YY2=[];
for f2=range
period=2*pi/w; %
step=2*pi/500/w;%步长。
y0=;
k=k+1
% discard the first 60 periodic data;
%除去前面60个周期的数据,并将最后的结果作为下一次积分的初值
tspan=;
=ode45(@dafen,tspan,y0);
nn =floor(length(Y)*0.9);
YY(k,:)=Y(nn:500:end,1);
end
figure
plot(range,YY,'k.','markersize',1);
figure
plot(Y(400000:end,1),Y(400000:end,2))
hold on
plot(Y(400000:500:end,1),Y(400000:500:end,2),'r.')
figure
plot(t(450000:end),Y(450000:end,1))
toc
function df=dafen(t,x)
global f2 walpha1 calpha3
df=[x(2);
-alpha1*x(1)-alpha3*x(1)^3+f2*cos(w*t)-c*x(2)];
end
楼主,帮忙给我看下和你的区别。是我哪里弄错了那
页:
1
[2]