Skip to main content
12-Amethyst
November 16, 2010
Solved

graphing non connected line segments, using matrices

  • November 16, 2010
  • 2 replies
  • 6131 views

I want to be able to graph a variable number of line segments, which may or may not be connected.

Say: P1 to P2, P3 to P4, P1 to P4, etc.

Can easily do by just plotting x-y corrdinate pairs for each end (x1 x2) and (y1 y2), but then I must include each set in the graph individually.

Plese see the attached; it seems that to be assured of getting the desired result I must do the following:

Each row of the X and Y matrices contains the corrdinates of each end of the segment, but I must add to that as follows:

each row of X ( xP1 - xP2 - xP1 - xLarge), Y (yP1 - yP2 - yP1 - yLarge)

and then in addition I must add a reference to a non-existant point. (j=0 to 5, instead of 4)

This is the only way I ave been able to "pick up and move the pen" to another piont.

I am almost embarrased to post that because it makes no sense, but maybe it does?

Is there a coherent explaniation for this? Is there a better way?

Thanks,

Wayne

Best answer by AlanStevens

Add a row of NaNs between each line.

Alan

2 replies

wayne12-AmethystAuthor
12-Amethyst
November 16, 2010

Attached fiel in version 11

1-Visitor
November 16, 2010
I am almost embarrased to post that because it makes no sense, but maybe it does?

Why would you be embarrassed to post a question? The reason you haven't had response is because it is a sparsely covered area.

I'm not sure exactly what you want, but I have had a go.

Mike

wayne12-AmethystAuthor
12-Amethyst
November 16, 2010

Mike, thanks for taking a stab at it.

a need a more automated solution, I may have 2 segments (structural elements) or I may have 10, 20, 30, maybe more down the road. I do not want to list each point individually.

The example at the end correctly reflects the structure. I have two questions:

1) The method works, but I cannot explain why, its sort of nonsensical, any logical explaination?

2) Is there a better method?

I don't really see anthing in help or the referenced, except in "Finite Element Beginnings", ans I had to take that another step to get what I needed.

I could potentially use this extensively, and I am sure there are many other have done, or would use If they knew.

Thanks,

Wayne

19-Tanzanite
November 17, 2010

Add a row of NaNs between each line.

Alan