0

I'm analyzing the maximum load for a mechanism in 2D-space and want to plot the load capacity for a certain point at different positions inside the working area and figured a contour plot with the position in x and y and the load as the color range would be appropriate.

I have the coordinates and load as functions of three variables in 3D matrices:

X = [x(alpha),x(beta),x(ext)]
Y = [y(alpha),y(beta),y(ext)]
F = [F(alpha),F(beta),F(ext)]

How would I arrange this data in order to plot it in any meaningful way? This is probably very basic, but I'm stuck and just can't see it. Any help is appreciated.

enter image description here

Ander Biguri
  • 35,140
  • 11
  • 74
  • 120
JaS
  • 1
  • 2
  • 1
    I vote to close, because you should know and decide which way you want to plot your data. We can help you then telling you how to do it. But the most important thing: please provide examplified data and post a picture (maybe from google?) how you want your plot. – Robert Seifert Mar 10 '15 at 09:30
  • Fair enough, I'll add a picture to better illustrate the problem. However the plot itself isn't the issue. it's how to go from 3 matrices containing basically 1D-data (but dependent on 3 variables) to a useful format for plotting. – JaS Mar 10 '15 at 10:08
  • @JaS About the data, some important things: I guess there is a x-y-z value for each point. Is the data ordered? Does the data define a regular grid? – Ander Biguri Mar 10 '15 at 14:20
  • @Ander Biguri No this is just a 2d planar case, each point has only coordinates in x and y. The point in question is located at the end of the mechanism and its coordinates has been calculated for the entire working area. x,y and F are all m*n*k matrices. Where the Alpha-dependency forms the rows, the Beta-dependency the columns and the Ext-dependency the depth. Ordered? I suppose so. A given element in one matrix refers to the same point in the working area as a element of the same number in the other matrices. – JaS Mar 10 '15 at 17:41
  • Based on this I tried to reshape X and Y into 1*numel(X) vectors but ran into trouble with the load matrix F since the contourf-function requires Z to be of size x*y and I didn't know how to adapt F to produce a meaningful result. – JaS Mar 10 '15 at 17:45
  • 1
    You must think of that we have are completely unaware of how your 3D matrix looks. You may also do the math, getting the x and y in absolute coordinates. We cannot do that since we do not have anything. We have no equation, except for the image, we have no data. Note that `contour` works on a rectangular grid. It cannot handle arbitrary coordinate systems, and definitely not multiple axis like you have. – patrik Mar 10 '15 at 17:53
  • @JaS You are not explaining yourself, nor understanding the question! Of course you have a x-y-z value. You can call them potato-banana-carrot or x-y-F, as you wish. To be able to pot a contour, you need to have a regular grid of x-y-F values! If they are just random poitns you cant. – Ander Biguri Mar 10 '15 at 17:57
  • Try: http://stackoverflow.com/questions/10068233/create-contour-plot-from-3-vectors – Ander Biguri Mar 10 '15 at 17:58
  • I'm sorry, my English is rusty and my knowledge of linear algebra has decayed beyond recognition. Right, a grid then? Okay, in every example I've seen you form a meshgrid [A,B] out of a and b (where a and b would be reshapen X and Y matrices in my case I guess?) and then you form Z from A and B. I want to use my F instead of Z in some way, how would I go about doing that? – JaS Mar 10 '15 at 18:22
  • F==Z. Its just terminology. First you need to decide wich range you want the plot to be. E.g. `x=1:0.1:10` , `y=30:100:10000`. Then you form a meshgrid with that. `meshgrid(x,y)`. Then you evaluate the value of `F` for each of those points. and thats it! – Ander Biguri Mar 11 '15 at 12:20
  • This much I get, but it's the process of getting my data into a useful form that stumps me. I tried a several approaches but always ended up running out of memory. So I ended up using a filled scatterplot instead. It isn't as pretty but it'll be sufficient enough and much more straight forward. Regardless I would like to thank you all for your time and effort. Thank you. – JaS Mar 13 '15 at 06:51

0 Answers0