plotfunc2d
-- 2D plots of
function graphsplotfunc2d
(f1, f2, ...)
generates a 2D
plot of the graphs of the univariate functions f1
,
f2
etc.
plotfunc2d( <SceneOptions,> f1, f2, ... <, Grid = n> )
plotfunc2d( <SceneOptions,> f1, f2, ..., x = xmin..xmax
<, Grid = n>)
plotfunc2d( <SceneOptions,> f1, f2, ..., x = xmin..xmax, y
= ymin..ymax <, Grid = n>)
f1, f1, ... |
- | the functions: arithmetical
expressions or piecewise objects containing one
indeterminate x |
x |
- | the horizontal coordinate: an identifier |
xmin, xmax |
- | the horizontal plot range: finite real numerical expressions |
y |
- | a dummy name for the vertical coordinate: an identifier. This name is used to label the y-axis. |
ymin, ymax |
- | the vertical plot range: finite real numerical expressions |
SceneOptions |
- | a sequence of scene options. These determine the
general appearance of the graphical scene. See ?plotOptions2d for details. |
Grid = n |
- | sets the number of sample points used for the plot.
The integer n must be larger than 1; the
default is Grid = 100 . |
MuPAD's graphics tool is called to render the graphical
scene. The null
()
object is returned
to the MuPAD session.
plot
, plot::Function2d
, plot2d
, plot3d
, plotfunc3d
x
that cannot be converted to floating point values.x
= -5..5
is used.y = ymin..ymax
is specified, only
function values between ymin
and ymax
are
displayed. The name y
of the vertical coordinate is
arbitrary: any identifier may be used.plot2d
as a
parametrized curve
[Mode = Curve, [x,
f(x)], x = [xmin, xmax] <, Options>]:
This way, ranges, color options and style options can be specified
separately for each function. See the help page of plot2d
for details.
plot
library
provides the routine plot::Function2d
which allows to
create a function graph as a graphical primitive, and to combine it
with other graphical objects.plotfunc2d
command, the PlotDevice scene option allows to specify the conversion
into the two MuPAD specific formats 'Ascii' and 'Binary'. See the help
page plotOptions2d
for details.
For graphical standard formats such as Postscript, JPEG, TIFF etc., no direct conversion is available by a plot command inside a MuPAD session. Instead, conversion has to be requested interactively via the graphical interface of the rendering tool VCam. In a MuPAD Pro notebook, double click on the graphics to activate this interface. Using the menu item ``Edit/Save Graphics ..'', you can choose the desired format in the ``Export Graphics'' dialog box.
n
n
must be larger than
1; the default is Grid =
100
. Large values of n
generate a smooth
graph.The following command draws the sine and the cosine functions on the interval [-PI, PI]:
>> plotfunc2d(sin(x), cos(x), x = -PI..PI):
Only real functions values are plotted:
>> plotfunc2d(sqrt(1 - x), sqrt(x), x = -2..2):
The following functions have singularities in the specified interval:
>> plotfunc2d(x/(x^3 - 4*x), x = -5..5):
>> plotfunc2d(1/sin(x), tan(x), x = 0..2*PI):
We define a vertical range to which the function graph is restricted:
>> plotfunc2d(tan(x), x = -3..3, y = -10..10):
The following function has a jump discontinuity:
>> plotfunc2d((x^2 - x)/(2*abs(x - 1)), x = -3..3, y = -3..3)
Piecewise defined functions are handled:
>> f := piecewise([x < 1, -x^2 + 1], [x >= 1, x]): plotfunc2d(BackGround = RGB::White, ForeGround = RGB::Black, GridLines = Automatic, Ticks = [Steps = 1, Steps = 1], f(x), x = -3..3, y = -3..3)
>> f := piecewise([x <= 0, x], [x > 0, 1/x]): plotfunc2d(BackGround = RGB::White, ForeGround = RGB::Black, GridLines = Automatic, Ticks = [Steps = 1, Steps = 1], f(x), x = -3..3, y = -3..3)
>> delete f:
We use the scene option AxesScaling to create a logarithmic plot:
>> plotfunc2d(AxesScaling = [Lin, Log], x^2, x^3, x = 1/10..10^3):
We demonstrate various further scene options in a doubly logarithmic plot:
>> plotfunc2d(Axes = Box, AxesScaling = [Log, Log], Discont = FALSE, BackGround = RGB::White, ForeGround = RGB::Black, GridLines = Automatic, GridLinesStyle = SolidLines, GridLinesColor = RGB::Gray, Ticks = [[10^i $ i = -1..3], [10^i $ i = -3..9]], x^2, x^3/(1 + x^(1/2)), x^3, x = 1/10..10^3):
plotfunc