How can i graph ponits with coord and value assigned, as colour graph
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(3 个)
Hugo
2013-6-14
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 个评论
Hugo
2013-6-14
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 个评论
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!