Reputation: 11
I couldn't find a solution after trying for a long time.
I have 3 columns of data: x
, y
, and the stress value (S
) at every point (x,y)
. I want to generate a 2D color plot displaying continuous color change with the magnitude of the stress (S
). The stress values increase from -3*10^4 Pa
to 4*10^4 Pa
. I only have hundreds of data points for an area, but I want to see the stress magnitude (read from the color) at every location (x, y)
. What Matlab command should I use?
I want to make a 2D color plot showing stress magnitude (S
) at every location (x, y)
based on continuous color change using limited data points
Upvotes: 0
Views: 1111
Reputation: 1
To further contribute on Gunther Struyf answer; assuming it is a FEM analysis you may already have a connectivity matrix say 'M' and 'x' 'y' column vectors with node coordinates. Stress values at the nodes may be contained in a column vector 'S'; then you may use the patch function as stated above:
patch('faces',M,'vertices',[x(:) y(:)],'facevertexcdata',S(:),'FaceColor','interp');
and you will have a 2D plot of your data similar to the one posted by Gunther Struyf.
Upvotes: 0
Reputation: 11168
I'd use patch with interpolated coloring:
% some data, x/y are random
N = 50;
x = rand(N,1);
y = rand(N,1);
S = sin(2*x)+y;
% plotting
tr = delaunay(x,y);
trisurf(tr,x,y,zeros(N,1),S,'FaceColor','interp');
view (2)
Upvotes: 2