Help with create Root Locus

4 views (last 30 days)
Jenia Doz
Jenia Doz on 10 May 2016
Answered: Sebastian Castro on 11 May 2016
Hello I need to build a function that will print a Root Locus without using the function of rlocus. this my code but I have missed something to get to the right answer.I would like if someone can fix my code or give me another code that works and create a root locus of random Transfer Function.Thanks. the code is:
clc;
s=tf('s');
k=0:0.1:20;
help pzmap
for i=1:1:length(k)
G=zpk([],[-5 2],1)
feedback(G,1)
pzmap(G)
end
hold off;
plot(real(G),imag(G))

Answers (1)

Sebastian Castro
Sebastian Castro on 11 May 2016
There is actually an rlocus function in Control System Toolbox.
>> rlocus(G)
If you want to do all the work yourself for some other reason:
k=0:0.1:20;
for idx = 1:numel(k)
closedLoop = feedback(G,k(idx));
p(:,idx) = pole(closedLoop);
end
figure
hold on
plot(real(p'),imag(p'))
- Sebastian

Tags

Community Treasure Hunt

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

Start Hunting!