MATLAB: How to determine the gain that is needed to get a second order closed loop system to oscillate indefinitely

Control System Toolboxgain marginmarginal stability

So i created a bode plot using margin() function and then multiplied my closed loop transfer function with the gain margin that I got from margin(). I created new transfer function for the system using X= feedback(K*G,1). When I made the step response graph with step(X), it didn't seem to oscillate indefinitely. What's wrong in my method?
Thank you foreahead for your answers!
Sincerely Yours, Jani

Best Answer

Can you paste your code. Seems like you are doing the right thing. Here is the code that does what you want.
s=tf('s')
ol=2/((s+1)*s*(s+10));
[gm,pm]=margin(ol);
step(feedback(ol,1),feedback(gm*ol,1),'r')
axis([0 30 0 2])
legend('original', 'multiplied by gm')
Related Question