| Contents | Index |
plot::Curve2d([x(t), y(t)], t =
..
) creates the planar curve
![]()
plot::Curve3d([x(t), y(t), z(t)], t =
..
) creates the space curve
![]()
Calls:
plot::Curve2d([x, y], t =
..
, <a = amin .. amax>, Options)
plot::Curve2d(
, t =
..
, <a = amin .. amax>, Options)
plot::Curve2d(
, t =
..
, <a = amin .. amax>, Options)
plot::Curve3d([x, y, z], t =
..
, <a = amin .. amax>, Options)
plot::Curve3d(
, t =
..
, <a = amin .. amax>, Options)
plot::Curve3d(
, t =
..
, <a = amin .. amax>, Options)
Parameters:
|
x, y, z: |
real-valued expressions in t (and possibly the animation parameter) |
|
|
a matrix of category Cat::Matrix with two entries that provide the parametrization x, y of a 2D curve |
|
|
a matrix of category Cat::Matrix with three entries that provide the parametrization x, y, z of a 3D curve |
|
|
a piecewise object |
|
t: |
an identifier or an indexed identifier |
|
|
real-valued expressions (possibly in the animation parameter) |
Related Domains:
plot::Function2d, plot::Function3d, plot::Polygon2d, plot::Polygon3d, plot::Surface
Related Functions:
Details:
plot::Curve2d and plot::Curve3d construct curves in one parameter (see example 1), possibly animated (see example 2). The curves may contain poles, in which case automatic clipping is used by default (see example 4).
By default, curves are sampled at equidistant values of the parameter t. The attribute AdaptiveMesh can be used to change this behavior, such that a denser sampling rate is used in areas of higher curvature. Cf. example 5.
Curves are graphical objects that can be manipulated, see the examples and the documentation of the parameters listed below for details.
Example 1
Archimedes' Spiral is defined by
. The corresponding call to plot::Curve2d reads:
curve := plot::Curve2d([r*sin(r), r*cos(r)], r = 0..35)
![]()
plot(curve)

Note that this particular example is even more straightforward to plot using plot::Polar.
Example 2
Continuing the example from above, we define an easy animation by making the angular part time-dependent:
curve := plot::Curve2d([r*sin(r-t), r*cos(r-t)],
r = 0..35, t = 0..2*PI,
TimeEnd = 5,
ViewingBox = [-25..25, -25..25]):
plot(curve)


Note that to start the animation, you have to double-click the image in the notebook and choose “Start” from the “Animation” menu.
Example 3
Another useful and easy type of animation is achieved by animating the parameter range. This creates the illusion of the curve being drawn in real time:
curve := plot::Curve2d([sin(thet), cos(thet)],
thet = 0..a,
a = 0..2*PI):
plot(curve)


curve := plot::Curve3d([sin(thet)*cos(20*thet),
sin(thet)*sin(20*thet),
cos(thet)],
thet = 0..a,
a = 0..PI):
plot(curve)


Combining this with an animated LineColorFunction, you can even simulate motion:
colorfunc := (thet, x, y, a) -> [a-thet, a-thet, 1.0]:
curve := plot::Curve2d([sin(3*thet), sin(4*thet)],
thet = a-1..a,
LineColorFunction = colorfunc,
LineWidth = 1,
a = 0..2*PI):
plot(curve)


Example 4
Curves with poles are automatically clipped:
curve := plot::Curve2d([(1+tan(3*t)^2)*sin(t),
(1+tan(3*t)^2)*cos(t)],
t = 0..2*PI):
plot(curve);

If the automatically chosen viewing box is not to your liking, you can explicitly set other values:
curve::ViewingBox := [-2..2, -2..2]:
plot(curve)

Example 5
By default, curves are drawn by evaluating at equidistant values of the curve parameter. For curves that have few regions of high curvature, this may be inappropriate:
plot(plot::Curve2d([arctan(t), t^2-10*exp(-50*t^2)],
t = -PI..PI))

Note the hard “kink” at the bottom of the picture. On the other hand, the remainder of the curve is sufficiently smooth, so globally increasing the number of evaluation points is not desirable. AdaptiveMesh makes plot::Curve2d look for these kinks and adaptively increase the mesh density in problematic areas:
plot(plot::Curve2d([arctan(t), t^2-10*exp(-50*t^2)],
t = -PI..PI, AdaptiveMesh = 2))

Example 6
To display a curve in the complex plane, map the list-valued function [Re, Im] to the curve:
plot(plot::Curve2d([Re, Im](zeta(I*y+1/2)), y=0..42,
AdaptiveMesh=3),
XAxisTitle = "Re(z)", YAxisTitle = "Im(z)")

Example 7
Create the following piecewise function:
f := piecewise([t < 0, [t, sin(10*t)^2, t^3]], [t >= 0, [t, 5*t/exp(t), -t^2]])
![piecewise([t < 0, [t, sin(10*t)^2, t^3]], [0 <= t, [t, 5*t*exp(-t), -t^2]])](PRIMITIV_Curve_images/math29.png)
Now, plot this function:
plot(plot::Curve3d(f, t = -10..10))


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 |