How can i graph ponits with coord and value assigned, as colour graph
1 view (last 30 days)
Show older comments
I am writing a Finite Element Method routine. Y have the coordinates of difrents points (x1,y1,x2,y2,x3,y3,.....) each point with a stress value asign. The idea is to graph those points with colors according to their values. It should look something like this:
thanks for any help!
0 Comments
Answers (3)
Hugo
on 14 Jun 2013
Have you taken a look at the command patch ? For example
patch('Vertices',V,'Faces',F,'FaceVertexCData',D,'FaceColor','interp','EdgeColor',somecolour,'FaceLighting','phong');
Suppose that you have N points
V are the spatial positions of the points: What you call coordinates.
F is a matrix of M rows and 3 columns. Each element in each row is a point (row in V). The three points define a triangle like the one in your figure example.
D is the stress value at each point.
The other options only change the colour presentation. "somecolour" should be replaced by a colour.
You can use in addition
colormap somecolormap;
colorbar
for changing the colormap (between hot, gray, or your own definition) and to add the colorbar.
Hope this helps. Best regards
0 Comments
Hugo
on 14 Jun 2013
The result of patch depends on the patches you define, so at least using patch, there is no other way.
What you can certainly do is to avoid patch and use surf if you only want to plot surfaces in 2D. But surf requires a 2D uniform grid. So you will need to define a 2D grid and then find the values in each node of the grid by combining the values at different locations using, for example, Gaussian filters (i.e. a Gaussian function in 2D). Are you familiar with that?
Best regards
0 Comments
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!