Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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
share|improve this answer
    
Thanks it should the numerator \$wn(idx)^2\$, other than that looks ok to me. –  MathematicalPhysicist Nov 18 '12 at 2:57
    
I haven't noticed that. Thanks for pointing it out. Edited my answer accordingly. –  HebeleHododo Nov 18 '12 at 11:13
    
You can write hold on instead of hold('on'); –  Szymon Bęczkowski Nov 18 '12 at 13:39
    
Well yeah, but I usually try to use the function syntax. I think it gives the code more consistency. Syntax documentation can be found here: mathworks.com/help/matlab/ref/syntax.html mathworks.com/help/matlab/matlab_prog/… –  HebeleHododo Nov 19 '12 at 6:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.