Plots the (x,y) lines solving an implicit equation or Function(x,y)=0
plotimplicit(fun) plotimplicit(fun, x_grid) plotimplicit(fun, x_grid, y_grid) plotimplicit(fun, x_grid, y_grid, plotOptions)
It may be one of the following:
"x^3 + 3*y^2 = 1/(2+x*y)"
,
"(x-y)*(sin(x)-sin(y))"
(implicitly = 0).besselj
(not "besselj"
).function r = test(x,y,a), r = x.*(y-a), endfunction
,
fun
can be list(test, 3.5)
to consider and compute test(x, y, 3.5)
.x_grid
and y_grid
define the cartesian
grid of nodes where fun
(x,y) must be computed.
By default, x_grid = [-1,1]
and
y_grid = x_grid
are used. To use default values,
just specify nothing. Example skipping y_grid
:
plotimplicit(fun, x_grid, , plotOptions)
.
Explicit x_grid
and y_grid
values
can be specified as follow:
[-2, 3.5]
. Then the given interval is sampled
with 201 points.-1:0.1:2
.:
. Then the considered interval
is given by the data bounds of the current or default axes.
This allows to overplot solutions of multiple equations on a shared
(x,y) domain, with as many call to plotimplicit(..)
as required.![]() | The bounds of the 1st plot drawn by plotimplicit(..)
are set according to the bounds of the solutions of
fun . Most often they are (much) narrower
than x_grid and y_grid bounds. |
plotimplicit(fun, x_grid, y_grid)
evaluates fun
on the nodes (x_grid
, y_grid
), and then
draws the (x,y) contours solving the equation fun
or such that
fun(x,y) = 0
.
When no root curve exists on the considered grid, plotimplicit
yields a warning and plots an empty axes.
![]() |
|
With the literal expression of the cartesian equation to plot:
// Draw a circle of radius 1 according to its cartesian equation: plotimplicit "x^2 + y^2 = 1" xgrid(color("grey"),1,7) isoview | ![]() | ![]() |
With the identifier of the function whose root lines must be plotted:
clf // 1) With a function in Scilab language (macro) function z=F(x, y) z = x.*(x.^2 + y.^2) - 5*(x.^2 - y.^2); endfunction // Draw the curve in the [-3 6] x [-5 5] range subplot(1,2,1) plotimplicit(F, -3:0.1:6, -5:0.1:5) title("$\text{macro: }x.(x^2 + y^2) - 5(x^2 - y^2) = 0$", "fontsize",4) xgrid(color("grey"),1,7) // 2) With a native Scilab builtin subplot(1,2,2) plotimplicit(besselj, -15:0.1:15, 0.1:0.1:19.9) title("$\text{built-in: } besselj(x,y) = 0$", "fontsize",4) xgrid(color("grey"),1,7) | ![]() | ![]() |
Using the default x_grid, a plotting option, and some post-processing:
equation = "3*x^2*exp(x) - x*y^2 + exp(y)/(y^2 + 1) = 1" plotimplicit(equation, , -10:0.1:10, "r--") // Increase the contours thickness afterwards: gce().children.thickness = 2; // Setting titles and grids title("$3x^2 e^x - x y^2 + {{e^y}\over{(y^2 + 1)}} - 1 = 0$", "fontsize",4) xgrid(color("grey"),1,7) | ![]() | ![]() |
Overplotting:
clf plotimplicit("x*sin(x) = y^2*cos(y)", [-2,2]) t1 = gca().title.text; c1 = gce().children(1); title("") plotimplicit("y*sin(y) = x^2*cos(x)", [-2,2], ,"r") t2 = gca().title.text; c2 = gce().children(1); title("$plotimplicit()$") legend([c1 c2],[t1 t2]); gce().font_size = 3; xgrid(color("grey"),1,7) | ![]() | ![]() |
Version | Description |
6.1.0 | Function introduced. |