Help with create Root Locus

4 次查看(过去 30 天)
Jenia Doz
Jenia Doz 2016-5-10
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))

回答(1 个)

Sebastian Castro
Sebastian Castro 2016-5-11
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

类别

Help CenterFile Exchange 中查找有关 Classical Control Design 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by