Rlocusplot provide gain K

Hello,

i have a problem that i want to provide K for rlocusplot, but it does no work.
thanks in advance

using ControlSystems
w0=2*pi
D=0.1
Ki=0.05

sys = Kiw0^2/(s^3+2Dw0s^2+w0^2s+Kiw0^2)

k=range(1e-6,stop=1000,length=20000)
#k=(0.001:0.001:1000)
rlocusplot(sys, k, xlims=(-4,4), ylims=(-10, 10))

Could you provide some details of what is not working, e.g. which error message you get?

Guessing from the code you gave, it seems there are many multiplication signs missing and also the definition of s, i.e. it should look more like

s = LinRange(-4,4, 20000) # or whatever range s has...
sys = @. Ki * w0^2 / (s^3 + 2D*w0*s^2 + s*w0^2 + Ki * w0^2)

At this point we can only guess what s is, but if it is a vector, then you need to add @. in front to make sure all operations are applied component-wise. (See also Mathematical Operations and Elementary Functions · The Julia Language)

rlocusplot has the following docstring

Computes and plots the root locus of the SISO LTISystem P with a negative feedback loop and feedback gains between 0 and K. rlocusplot will use an adaptive step-size algorithm to determine the values of the feedback gains used to generate the plot.

The OP does not contain this information, but s is the Laplace-transform s, created using

s = tf('s')

There are still some multiplications missing in the expression in the OP.

1 Like

yes. There are some Probleme, when i copy the code.


My confusion lies in the use of K in the function. I tried providing a value for K to increase the range of the root, but none of it changed the original Plot.

You might have to change the xlims, ylims of the plot manually