# Rlocusplot() does not plot the roots

**URL:** https://discourse.julialang.org/t/rlocusplot-does-not-plot-the-roots/88547
**Category:** Modelling & Simulations
**Tags:** controlsystems
**Created:** [October 11, 2022, 12:36am UTC](https://discourse.julialang.org/t/rlocusplot-does-not-plot-the-roots/88547 "2022-10-11T00:36:39Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![lucasmsoares96](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lucasmsoares96/32/38743_2.png) [@lucasmsoares96](https://discourse.julialang.org/u/lucasmsoares96)
#### Post date: [October 11, 2022, 12:36am UTC](https://discourse.julialang.org/t/rlocusplot-does-not-plot-the-roots/88547/1 "2022-10-11T00:36:39Z")

</div>

Hello guys. I’m having trouble plotting the root locus diagram. He doesn’t show my roots.

```plaintext
X(s) = \frac{6s+204}{s^3+10s^2+34s}

```

```julia
using ControlSystems
sys2 = tf(
	[6,204],
	[1,10,34,0]
)
rlocusplot(sys2)

```

The Julia code above draws the following graph:

![teste](https://global.discourse-cdn.com/julialang/original/3X/d/e/de1df85f604d1f7e15a7841ac64ccffaaa85405c.png)

But the scilab equivalent shows a root close to -35.

![scilab](https://global.discourse-cdn.com/julialang/original/3X/9/0/90603af09a5c3ce842c50244320279cbdb839eb1.png)

How do I show the hidden root?

---

<div class="post-metadata">

### Author: ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)
#### Post date: [October 13, 2022, 4:09am UTC](https://discourse.julialang.org/t/rlocusplot-does-not-plot-the-roots/88547/2 "2022-10-13T04:09:50Z")

</div>

Try setting the `xlim` keyword argument.

---

<div class="post-metadata">

### Author: ![uniment](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/uniment/32/24532_2.png) [@uniment](https://discourse.julialang.org/u/uniment)
#### Post date: [October 13, 2022, 8:49am UTC](https://discourse.julialang.org/t/rlocusplot-does-not-plot-the-roots/88547/3 "2022-10-13T08:49:47Z")

</div>

As @baggepinnen says, try

```julia
rlocusplot(sys2, xlims=(-40, 10))

```

Part of the `rlocusplot` recipe (in src/root\_locus.jl) is the line,

```julia
xlims --> (max(-50,minimum(redata) - 1), clamp(maximum(redata) + 1, 1, 50))

```

This finds the limits of the _calculated root positions_ as the gain `K` is swept from 1e-6 to 500, but unfortunately this doesn’t include the location of the zero in this case.

---

<div class="post-metadata">

### Author: ![runjaj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/runjaj/32/23628_2.png) [@runjaj](https://discourse.julialang.org/u/runjaj)
#### Post date: [October 13, 2022, 10:46am UTC](https://discourse.julialang.org/t/rlocusplot-does-not-plot-the-roots/88547/4 "2022-10-13T10:46:34Z")

</div>

Another package to analyse control systems is [controlz.jl](https://simonensemble.github.io/Controlz.jl/dev/):

 ![rootlocus_controlz](https://global.discourse-cdn.com/julialang/original/3X/1/d/1d437817042599ccfbc351953882aa76e9fd342b.png)
