In the automatic control principle and signal and system, use MATLAB to find the unit step response, and analyze the influence of damping ratio and natural oscillation angular frequency on transient performance.
Take the example title in Xia Deqian's "Automatic Control Theory" 4th Edition as the starting point:
the code is as follows:
w = 1; %Wn的取值
%w = 5;%Wn的另一个取值
num = [w^2];
p = [0 0.2 0.5 0.707 1.0 1.25]; %ζ的取值
den1 = [1 2*p(1)*w w^2 ];
den2 = [1 2*p(2)*w w^2 ];
den3 = [1 2*p(3)*w w^2 ];
den4 = [1 2*p(4)*w w^2 ];
den5 = [1 2*p(5)*w w^2 ];
den6 = [1 2*p(6)*w w^2 ];
sys1=tf(num, den1);
sys2=tf(num, den2);
sys3=tf(num, den3);
sys4=tf(num, den4);
sys5=tf(num, den5);
sys6=tf(num, den6);
t = 20/w;%限定t时间范围,以获得合适的图像。
step(sys1,sys2,sys3,sys4,sys5,sys6,t);
title('ω=1');
%title('ω=5');
legend('ζ=0','ζ=0.2','ζ=0.5','ζ=0.707','ζ=1.0','ζ=1.25');
The effect is as shown in the figure:
When you need to switch w, just change the 1 in the first line to 5 or other numbers.