MATLAB Answers

MUPAD plot multiple points

조회 수: 139(최근 30일)
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
In Mupad, plot(3,r) does not work... What is the correct syntax?

채택된 답변

Christopher Creutzig
If you already have multiple points (not just the vector r), you can get a line through them this way:
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

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by