cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Plotting Point

h_nas
4-Participant

Plotting Point

Hi,

I would like to use MP3 2D plot, like we use to do in the good old days?

I have points

x=(10,0)

Y=(10,20)

and so one r, e, h, etc...

how can I input these point into the plot

and how can I connect these points by lines?

I hope it will not be a complicated procedure:)

Regards,

H

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:h_nas)

I'll try my best.

In my first reply you saw that we can draw points and connect them if we simply plot a vector of y-coordinates over the corresponding vector of x-coordinates. In the plot formatting ribbon we can then select, color, line style and thickness (or if we want the dots connected at all), if we want to see the points and what symbol. Unfortunately we cannot set linethickness and size of the point symbol separately.

In the new sheet I created the data in a n x 2 matrix. The first column being the x-coordinates and the second the y-coordinates. In the plot region you see that I selected the appropriate column using the column-selector you get by pressing ctrl-shift-C.

I also made use of NaN. This stands for "Not-a-Number" and has the effect in 2D-plots that the connection between the points is broken. Much like a "penup" command in a turtle-like drawing program. For my convenienceI I had setup a 1x2 row of NaN's and called this stop.

Next thing I used was the stack command. This command does what it says, it stacks matrices or scalars one on top of the other. This allows me to develop the datastructure for the full plot step by step.

Lets say I create a 3x2 Matrix A representing 3 points forming an "L", top of the "L" is the first line. Then I create a 1x2 matrix B representing a single point, lets say in the upper right over the lower right point of the "L". So C:=stack(A,B) will create a datastrucure which looks like an "U" if plotted.

Last thing is the arc routine. It returns a 2-column matrix of point coordinates which form (part) of a circle. The function has 6 parameters:

  1. x-coordinate of the center of the circle
  2. y-coordinate of the center of the circle
  3. radius of the circle
  4. starting angle (0 is at the right, counter clockwise measured, so 90° is at the top)
  5. ending angle
  6. number of points which should be created

You may create similar routines like arc to return different shapes. For an ellipse you would add just two additional parameters (half the minor axis and the angle of the major axis e.g.) and change the equations accordingly.

You may draw circuit diagrams and make routines for capacity, resistor and coil/inductivity. But who would do that? Its nice we could do it, but thats sure not what Mathcad is made for.

HinndNaser wrote:

That is what I am looking for actually, but the one I am doing doesnt end up being cars:),

Hmm, isn't it a baby stroller? 🙂

So what is it you will end up with?

View solution in original post

9 REPLIES 9
Werner_E
25-Diamond I
(To:h_nas)

Doesn't it work the same as in the good old days of Mathcad (15 and below)?

Plotting the vector of ordinates over the vector of abscissa values.

Or am i missing the point?

Maybe you should provide a worksheet including the data you want to plot.

h_nas
4-Participant
(To:Werner_E)

I should have explaind, the good old days is when you have a graph paper:) and a pencil to draw a line connecting two points.

Werner_E
25-Diamond I
(To:h_nas)

Is it something like this you are after?

You will have to sparate x- and y-coordinates of your points.

plot2d.png

h_nas
4-Participant
(To:Werner_E)

Actuly, yes, thank you

Another question, what if the connection for some of these points are arc instead of a line, say quarter of a circle?

what would you do?

Regards,

Werner_E
25-Diamond I
(To:h_nas)

You may use a spline interpolation to connect the data points mor smoothly. But for doing so, the x-values would have to be in ascending order (which is not the case in the examples given.

What would i do if i wanted to draw a circle or a quarter of it? There are various ways but I guess I'd prefer a parametric functional representation.

Werner_E
25-Diamond I
(To:h_nas)

HinndNaser wrote:

Another question, what if the connection for some of these points are arc instead of a line, say quarter of a circle?

You know that Mathcad is not a drawing program? It will plot "just" functions and vectors/matrices.

plot2d_2.png

h_nas
4-Participant
(To:Werner_E)

That is what I am looking for actually, but the one I am doing doesnt end up being cars:), but I am not that advanced in MP3, do you mind to explain this programe further.

Regards,

Werner_E
25-Diamond I
(To:h_nas)

I'll try my best.

In my first reply you saw that we can draw points and connect them if we simply plot a vector of y-coordinates over the corresponding vector of x-coordinates. In the plot formatting ribbon we can then select, color, line style and thickness (or if we want the dots connected at all), if we want to see the points and what symbol. Unfortunately we cannot set linethickness and size of the point symbol separately.

In the new sheet I created the data in a n x 2 matrix. The first column being the x-coordinates and the second the y-coordinates. In the plot region you see that I selected the appropriate column using the column-selector you get by pressing ctrl-shift-C.

I also made use of NaN. This stands for "Not-a-Number" and has the effect in 2D-plots that the connection between the points is broken. Much like a "penup" command in a turtle-like drawing program. For my convenienceI I had setup a 1x2 row of NaN's and called this stop.

Next thing I used was the stack command. This command does what it says, it stacks matrices or scalars one on top of the other. This allows me to develop the datastructure for the full plot step by step.

Lets say I create a 3x2 Matrix A representing 3 points forming an "L", top of the "L" is the first line. Then I create a 1x2 matrix B representing a single point, lets say in the upper right over the lower right point of the "L". So C:=stack(A,B) will create a datastrucure which looks like an "U" if plotted.

Last thing is the arc routine. It returns a 2-column matrix of point coordinates which form (part) of a circle. The function has 6 parameters:

  1. x-coordinate of the center of the circle
  2. y-coordinate of the center of the circle
  3. radius of the circle
  4. starting angle (0 is at the right, counter clockwise measured, so 90° is at the top)
  5. ending angle
  6. number of points which should be created

You may create similar routines like arc to return different shapes. For an ellipse you would add just two additional parameters (half the minor axis and the angle of the major axis e.g.) and change the equations accordingly.

You may draw circuit diagrams and make routines for capacity, resistor and coil/inductivity. But who would do that? Its nice we could do it, but thats sure not what Mathcad is made for.

HinndNaser wrote:

That is what I am looking for actually, but the one I am doing doesnt end up being cars:),

Hmm, isn't it a baby stroller? 🙂

So what is it you will end up with?

h_nas
4-Participant
(To:Werner_E)

Thank you

Announcements

Top Tags