📄 chap2_fig7_11.m
字号:
% Chap2_Fig7_10.m
clc, clear all, close all
hold on
max_x=1;
wn=1;
t=linspace(0,6*pi/wn,500);
for n=1:5
x0=-1+2*rand;
x0_dot=-1+2*rand;
x=x0*cos(wn*t)+(x0_dot/wn)*sin(wn*t);
if max(x)>max_x
max_x=max(x);
end
xdot=-wn*x0*sin(wn*t)+x0_dot*cos(wn*t);
figure(1)
plot(x,xdot)
plot(x0,x0_dot,'.r','MarkerSize',12)
axis equal
M=1.15*max_x;
axis([-M M -M M])
plot([-M M],[0 0],'k')
plot([0 0],[-M M],'k')
xlabel('\itx')
ylabel('\itdx/dt')
title('State Trajectories of 5 Undamped Linear 2nd Order Systems with Random Initial States')
text(0.5,1.15,'\omega_{\itn} \rm= 1 rad/sec')
if n==1|n==3|n==5
figure(2)
subplot(2,1,1)
hold on
plot(t,x)
ylabel('\itx')
title('Sustained Oscillations of \itx \rmfor 3 Undamped Linear 2nd Order Systems')
subplot(2,1,2)
hold on
plot(t,xdot)
xlabel('\itt')
ylabel('\itdx/dt')
title('Sustained Oscillations of \itdx/dt \rmfor 3 Undamped Linear 2nd Order Systems')
end
end
figure(1)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -