Help with create Root Locus
4 views (last 30 days)
Show older comments
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))
0 Comments
Answers (1)
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
0 Comments
See Also
Categories
Find more on Classical Control Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!