MUPAD plot multiple points

13 views (last 30 days)
I know its a basic question but i am stuck and could not find the answer yet:
How to plot multiple points? In Matlab if i have a vector (e.g.
r = 2:6
), they all can be plotted by
plot(3,r)
In Mupad, plot(3,r) does not work... What is the correct syntax?

Accepted Answer

Christopher Creutzig
Christopher Creutzig on 1 Sep 2014
If you already have multiple points (not just the vector r), you can get a line through them this way:
plot([[1,2],[3,10],[4,6]])
Or dots at those places like this (or use plot::PointList2d):
plot({[1,2],[3,10],[4,6], #Points})
If you have a vector, list of values, or sequence of values (these are different in MuPAD, though not in MATLAB), such as r := [$2..6], and want to get the equivalent to MATLAB's plot(3,r), you need to convert them to a point list first:
r := [$2..6]:
plot([[3,y] $ y in r]) // line, a bit pointless
plot([[3,y] $ y in r], PointsVisible) // more pointed
plot({[3,y] $ y in r, #Points}) // single color
plot([3,y] $ y in r, #Points) // individually colored

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!