📄 chap2_figs7_11&12.m
字号:
% Chap2_Figs7_11&12.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',10)
axis equal
M=1.1*max_x;
axis([-M M -M M])
plot([-M M],[0 0],'k')
plot([0 0],[-M M],'k')
xlabel('\itx','FontSize',11)
ylabel('\itdx/dt','FontSize',11)
title('State Trajectories of Undamped Second Order Systems (Random Initial States)','FontSize',11)
%if n==1|n==3|n==5
figure(2)
subplot(2,1,1)
hold on
plot(t,x)
axis([0 t(end) 1.1*min(x) 1.1*max(x)])
ylabel('\itx','FontSize',11)
title('Sustained Oscillations of \itx \rmfor Undamped Second Order Systems','FontSize',11)
subplot(2,1,2)
hold on
plot(t,xdot)
axis([0 t(end) 1.1*min(xdot) 1.1*max(xdot)])
xlabel('\itt','FontSize',11)
ylabel('\itdx/dt','FontSize',11)
title('Sustained Oscillations of \itdx/dt \rmfor Undamped Second Order Systems','FontSize',11)
%end
end
figure(1)
gtext('\omega_{\itn} \rm= 1 rad/sec','FontSize',11)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -