参考:
代码:
%% 画不同阻尼比(欠阻尼系统)下二阶系统的幅频相频
clc;
lambda=0:0.05:2.5;
for kesai=[0,0.1,0.2,0.3,0.5,1.0]
% 画幅频
magG=1./((1-lambda.^2).^2 + (2*kesai*lambda).^2).^0.5;
faiG=atan2d(2*kesai*lambda,(1-(lambda).^2));
subplot(2,1,1)
%像
%图线
h_p1=plot(lambda,magG);
hold on;
%坐标
h_a1=gca;
set(h_a1,'xlim',[0,2.5],'YLim',[0,5]);
set(h_a1,'xgrid','on','ygrid','on');
xlabel('Frequence Ratio $r = \frac{f}{{{f_n}}}$','Interpreter','latex');
ylabel('Amplification Ratio $X\frac{k}{{{F_0}}}$','Interpreter','latex');
set(h_a1,'fontname','times new roman','fontweight','bold');
%例
%文
%标题
title('Amplitude','FontName','times new roman','fontweight','bold');
% 画相频
subplot(2,1,2)
%像
%图线
h_p2=plot(lambda,faiG);
hold on;
%坐标
h_a2=gca;
set(h_a2,'xlim',[0,2.5],'YLim',[0,180]);
set(h_a2,'xgrid','on','ygrid','on');
xlabel(' Frequence Ratio $r = \frac{f}{{{f_n}}}$','Interpreter','latex');
ylabel('Phase Angle(deg) $ \phi $','Interpreter','latex');
set(h_a2,'fontname','times new roman','fontweight','bold');
%例
%文
%标题
title('Phase','FontName','times new roman','fontweight','bold');
end
结果: