| Contents | Index |
plot::Rootlocus(p(z, u), u =
..
) creates a 2D plot of the curves in the complex plane given by the roots of
(solved for
) as the parameter
varies between
and
.
Call:
plot::Rootlocus(
, u =
..
, <a = amin .. amax>, Options)
Parameters:
|
|
an arithmetical expression in two unknowns |
|
z: |
name of the unknown: an identifier or an indexed identifier. |
|
u: |
name of the curve parameter: an identifier or an indexed identifier. |
|
|
the range of the curve parameter: |
See Also:
numeric::polyroots, plot, plot::copy, plot::Curve2d
Details:
For any given value of
, plot::Rootlocus solves the equation
for
. The solutions define points with coordinates
,
in the complex plane. As the parameter
varies, the solutions form continuous curves that a depicted by plot::Rootlocus.
The roots of the numerator of p(z, u) are considered. All complex solutions of this polynomial in
are computed numerically via numeric::polyroots.
The polynomial is initially solved for some values
from the range
. The optional argument Mesh =
can be used to specify the number
of these initial points (the default value is 51). These points are not equally spaced, but accumulate close to the end of the range.
The routine then tries to pair up the roots for adjacent values of
by choosing those closest to each other.
Finally, the routine tries to trace out the different curves by joining up adjacent points with line segments. If adjacent line segments exhibit angles that are not close to 180 degrees, additional roots are computed for parameter values
between the values of the initial mesh. Up to
such bisectioning steps are possible, where
is specified by the optional argument AdaptiveMesh =
(the default value is 4). With AdaptiveMesh =
, this adaptive mechanism may be switched off.
Sometimes, the matching up of the roots to continuous curves can be fooled and the result is a messy plot. In such a case, the user can take the following measures to improve the plot:
The parameter range
may be unreasonably large. Reduce this range to a reasonable size!
Increase the size
of the initial mesh using the option Mesh =
. Note that increasing
by some factor may increase the runtime of the plot by the same factor!
Increase the number
of possible adaptive bisectioning steps using the option AdaptiveMesh =
. Note that increasing
by
may increase the runtime of the plot by a factor of
!
Using the options LinesVisible = FALSE in conjunction with PointsVisible = TRUE, the roots are displayed as separate points without joining line segments.
Cf. example 2.
Animations are triggered by specifying a range
for a parameter a that is different from the variables z and u. Cf. example 3.
The curves can be colored by a user defined color scheme. Just pass the option LineColorFunction = mycolor, where mycolor is a user definied procedure that returns an RGB color value. The routine plot::Rootlocus calls mycolor(u, x, y), where
is the parameter value and
,
are the real and imaginary parts of the root of
. Cf. example 4.
Example 1
The roots of the polynomial
are given by
and
. We visualise these two curves via a rootlocus plot:
plot(plot::Rootlocus(z^2 - 2*u*z + 1, u = -1.5..1.5))

For rational expressions, the roots of the numerator are considered. The following plot displays the roots of the numerator polynomial
:
plot(plot::Rootlocus(1 + u * (z - u)^3/(z^2 - u)^2, u = -1..1)):

Here are various other examples:
plot(plot::Rootlocus((z^2 - 2*u*z + 1)^2 + u, u = -1..1))

plot(plot::Rootlocus((z^2 - u)^6 + u^2, u = -2..2, Color = RGB::Red))

plot(plot::Rootlocus((z^5 - 1)^3 + u, u = -1..1, PointsVisible, PointSize = 1.5))

Example 2
The following plot is rather messy, since the default mesh size of 51 initial points on each curve is not sufficient to obtain a good resolution:
plot(plot::Rootlocus((z-u)^3 - u/z^3, u = -10^3 .. 10^3)):

We obtain a better resolution by decreasing the range of the parameter
to a reasonable size. There are still a few points that are not properly matched up with the curves:
plot(plot::Rootlocus((z-u)^3 - u/z^3, u = -10 .. 10)):

We increase the mesh size to cure this problem:
plot(plot::Rootlocus((z-u)^3 - u/z^3, u = -10 .. 10, Mesh = 251)):

We plot the roots as separate points without displaying connecting line segments:
plot(plot::Rootlocus((z-u)^3 - u/z^3, u = -10 .. 10, Mesh = 501,
LinesVisible = FALSE, PointsVisible)):

Example 3
We animate the expression whose roots are to plotted:
plot(plot::Rootlocus(z^2 - 2*u*z + a, u = -1..1, a = -0.2 .. 2, Mesh = 10),
plot::Text2d(a -> "a = ".stringlib::formatf(a, 2, 5), [1.2, 1.0], a = -0.2 .. 1));


We animate the parameter range:
plot(plot::Rootlocus(z^2 - 2*u*z + 0.81, u = -1 .. a, a = -1 .. 1, Mesh = 10))


Example 4
We provide a color function: roots for small values of the parameter
are displayed in red, whereas roots for large parameter values are displayed in blue:
plot(plot::Rootlocus(z^2 - 2*u*z + 0.81, u = -1..1,
LineColorFunction = ((u, x, y) -> [(1 - u)/2, 0, (1 + u)/2])))


Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |