How to plot location and magnitude

7 views (last 30 days)
Adikar
Adikar on 3 Jul 2013
Hi All
I currently have three vectors two of which contain x and y coordinates, and the last one containing stress magnitudes. How can I go about creating a smooth coloured plot which contains the stress magnitude at its x and y location? I have tried the surf(x,y,z) and also tried surf(x,y,z,C) where z is just a zero vector the same length as z and y, but still it does not work. Any help would be much appreciated
  2 Comments
José-Luis
José-Luis on 3 Jul 2013
Could you show an example of what you are trying to achieve and what you get at the moment?
Adikar
Adikar on 3 Jul 2013
As an example, say I'll have the following vectors:
x=[0 0 0 1 1 1]'
y=[0 1 2 0 1 2]'
these basically make up locations on a rectangular grid. I then have the vector, say:
C=[15 10 0 20 10 0]'
For which each value is located at the x-y coordinate pair. So C(i) is located at x(i),y(i). I've tried using surf (x,y,C) but matlab returns basically that C needs to be a matrix. I essentially want a 2-D plot that looks like a stress distribution but don't have a clue how to move forward.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 3 Jul 2013
TriScatteredInterp class, or its new replacement scatteredinterpolantclass . You would interpolate over a grid.

Categories

Find more on Stress and Strain in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!