How can i graph ponits with coord and value assigned, as colour graph

3 visualizzazioni (ultimi 30 giorni)
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!

Risposte (3)

Hugo
Hugo il 14 Giu 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

German
German il 14 Giu 2013
First of all, thanks! It worked pretty well, but there were some details: -The points i have, are not the nodes of the elements, but they are the gaus points (points inside de element) for each element. So i had to make a small routine to connect all the points with there "neighbor" points on every element. But there was a lack of connectivity between the point of differents elements. A image is worth more than thousen words..
So is there any way to not have to give the conectivity between points?
Any way, i works pretty good for the objective i had in mind, im asking just in case of... to make an even better job! Thanks for all man! you save me a lot of time!

Hugo
Hugo il 14 Giu 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

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by