Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - 日本語

Change language to:
English - Français - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Scilabヘルプ >> Graphics > 2d_plot > plotimplicit

plotimplicit

Plots the (x,y) lines solving an implicit equation or Function(x,y)=0

Syntax

plotimplicit(fun)
plotimplicit(fun, x_grid)
plotimplicit(fun, x_grid, y_grid)
plotimplicit(fun, x_grid, y_grid, plotOptions)

Arguments

fun

It may be one of the following:

  • A single Scilab-executable string expression of literal scalar variables "x" and "y" representing two scalar real numbers. Examples: "x^3 + 3*y^2 = 1/(2+x*y)", "(x-y)*(sin(x)-sin(y))" (implicitly = 0).
  • The identifier of an existing function of two variables x and y. Example: besselj (not "besselj").
  • A list, gathering a Scilab or built-in function identifier, followed by the series of its parameters. Example: After 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, y_grid

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:

  • A vector of 2 real numbers = bounds of the x or y domain. Example: [-2, 3.5]. Then the given interval is sampled with 201 points.
  • A vector of more than 2 real numbers = values where the function is computed. Example: -1:0.1:2.
  • The colon :. 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.

plotOptions
List of plot() line-styling options used when plotting the solutions curves.

Description

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.

  • plotimplicit(..) can be used in a subplot.

  • plotimplicit(..) can be called several times for the same axes, to overplot the solutions of several implicit equations (and show their possible intersections).

  • Before returning, plotimplicit bundles all plotted curves into a graphical compound addressable as gce().children. If no solution exists, gce() is set to gca().

Examples

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)

See Also

  • fsolve — n個の非線形関数システムのゼロを見つける
  • contour2d — 3次元曲面に等高線を描画
  • contour2di — 2次元プロット上の曲面の等高線を計算
  • contour2dm — compute level curves of a surface defined with a mesh
  • LineSpec — プロットの線の外観を簡単にカスタマイズするための仕様
  • GlobalProperty — plotまたはsurfコマンドでオブジェクト(曲線,曲面...)の外観をカスタマイズ.
  • plot — 2Dプロット

History

VersionDescription
6.1.0 Function introduced.
Report an issue
<< plot2d4 2d_plot polarplot >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 25 08:53:22 CET 2020