First, write out the fractional expression of the second-order system, determine the frequency range to be plotted, and then use the bode function to plot the frequency characteristic curves of the system for different damping values.
% Plotting frequency characteristics for different damping ratios
wn1=10;
zeta1=0.2:0.1:1.2;
w1=logspace(-1,2,100);
num1=wn1*wn1;
figure(1);
for k1=zeta1
den1=[1.0 2*k1*wn1 wn1*wn1 ];
[mag1, pha1,w2]=bode(num1,den1,w1);
subplot(211);
semilogx(w2,mag1);
hold on;
subplot(212);
semilogx(w2,pha1);
hold on;
end
subplot(211);
grid on; grid; grid;
title(‘Frequency Characteristics’);
xlabel(‘rad/s’);
ylabel(‘gain(dB)’);
subplot(212);
grid on; grid; grid;
title(‘Phase Characteristics’);
xlabel(‘rad/s’);
ylabel(‘degree(°)’);