Using Matlab to draw a step response graph

controlcontrol systemMATLAB

I've got the next transfer function:

$$ \frac{\hat{\alpha}}{\hat{\alpha_{ref}}} =\frac{w_n^2}{s^2+2w_n \xi s+ w_n^2} $$

Now I want to draw a step response input at height of \$\alpha_{ref}\$, where \$\xi\$ comes with differing values (i.e different graphs on the same axis for different values of \$\xi\$, and the value of \$w_n\$ depends on \$\xi\$).

How to implement this in Matlab?

Thanks in advance.

Best Answer

A not-at-all elegant way to do it is:

zeta=[...]; %your zeta values
wn = ... % calculate your wn values according to your zeta values
figure;
hold('on');
for idx = 1:length(zeta)
    % sys = tf([wn(idx)],[1 2*wn(idx)*zeta(idx) wn(idx)^2]); %system's transfer function
    % EDIT : numerator corrected
    sys = tf([wn(idx)^2],[1 2*wn(idx)*zeta(idx) wn(idx)^2]); %system's transfer function
    step(alpharef*sys);
end