MATLAB Answers

Using a while loop in MATLAB, verify your result in (b) by computing the poles of the closed-loop transfer function as k increases from 0.001 in increments of 0.001. When your loop finishes running, display the largest gain k = kmax that guarantees..

7 views (last 30 days)
Mirza Wali Ali Baig
Mirza Wali Ali Baig on 2 Jul 2020
I found a stability k factor by hand for a unity feedback control system.
I am geting stuck on this part.
Using a while loop in MATLAB, verify your result in (b) by computing the poles of the closed-loop transfer function as k increases from 0.001 in increments of 0.001. When your loop finishes running, display the largest gain k = kmax that guarantees closed-loop stability. Hint: >> help max, >> help pole, >> help real
this is my code so far.
s = tf('s'); %define transfer function variable
k = 0.001;
SYS = (10*k*(s+1)) / ( s^4 + 4*s^3 + 9*s^2 + (10*k + 10)*s); %define TF
while k < kmax
pole(SYS)
k = k + 0.001; %increment k
end
disp kmax
help would be appreciated
[SL: formatted the code as code]

Answers (1)

Sarvani Panguluri
Sarvani Panguluri on 6 Aug 2020
Hi,
I assume you are trying to find the maximum k for which the system is stable. As per my knowledge, the system is stable when the poles of closed loop transfer function lie on the left-hand side of the s-plane. So, the real part of the poles have to negative.
try implementing the following code.
s = tf('s'); %define transfer function variable
k =0.001;
temp=true;
while temp
SYS = (10*k*(s+1)) / ( s^4 + 4*s^3 + 9*s^2 + 10*k*s + 10*k);
if(all(real(pole(SYS)) <=0))
k=k+0.001;
else
temp=false;
end
end
disp(k-0.001)
Hope it helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!