📄 chap2_figs7_13&14.m
字号:
% Chap2_Figs7_13&14.m
clc, clear all, close all
a=10; b=2; c=4; d=12;
T=0.00005;
tfinal=1.5;
nfinal=round(tfinal/T);
max_x1=1; max_x2=1;
t=0:T:tfinal-T;
for i=1:5
x10=10*rand; x20=10*rand;
x1(1)=x10; x2(1)=x20;
for n=1:nfinal-1
x1(n+1)=x1(n)+T*x1(n)*(a-b*x2(n));
x2(n+1)=x2(n)+T*x2(n)*(c*x1(n)-d);
end % n
M1=max(x1); M2=max(x2);
if M1>max_x1
max_x1=M1;
end
if M2>max_x2
max_x2=M2;
end
figure(1)
plot(x1,x2)
axis([0 1.05*max_x1 0 1.05*max_x2])
hold on
plot(x10,x20,'.r','MarkerSize',12)
figure(2)
%if i==1|i==3|i==5
subplot(2,1,1)
hold on
plot(t,x1)
ylabel('\itx_{\rm1}','FontSize',11)
title('Sustained Oscillations of \itx_{\rm1} \rmfor Nonlinear Second Order Systems','FontSize',11)
subplot(2,1,2)
hold on
plot(t,x2)
xlabel('\itt','FontSize',11)
ylabel('\itx_{\rm2}','FontSize',11)
title('Sustained Oscillations of \itx_{\rm2} \rmfor Nonlinear Second Order Systems','FontSize',11)
%end
end % i
figure(1)
xlabel('\itx_{\rm1}','FontSize',11)
ylabel('\itx_{\rm2}','FontSize',11)
title('Closed Orbits of Nonlinear Second Order System (Random Initial States)','FontSize',11)
text(0.6*max_x1,1.0*max_x2,'\ita \rm= 10, \itb \rm= 2, \itc \rm= 4, \itd \rm= 12','FontSize',11)
text(0.6*max_x1,0.9*max_x2,'\itx_{\rm1,e} = d/c = 3, \itx_{\rm2,e} = a/b = 5','FontSize',11)
x1e=d/c; x2e=a/b;
plot([x1e-0.1 x1e+0.1],[x2e x2e])
plot([x1e x1e],[x2e-0.2 x2e+0.2])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -