How to create a 3D-strain map?

5 Ansichten (letzte 30 Tage)
Andrea Sánchez Fernández
Andrea Sánchez Fernández am 28 Apr. 2020
Beantwortet: Sara am 21 Jun. 2021
Hi everybody!
I have the following question:
I have four column vectors which are: coordinate x, coordinate y, coordinate z and the equivalent strain at each point. The sizes of the vectors are 20500x1. What I need is a plot of the volume with the coordinates like a mesh coloured based on the equivalent strain values. I have used the following lines:
figure
[xi,yi]= meshgrid(linspace(min(eqstrainx),max(eqstrainx),150), ...
linspace(min(eqstrainy),max(eqstrainy),150));
% [xi,yi] = meshgrid(min(t_nodex):0.1:max(t_nodex), min(t_nodey):0.1:max(t_nodey));
zi = griddata(eqstrainx,eqstrainy,eqstrainz,xi,yi);
surf(xi,yi,zi);
Tin=scatteredInterpolant(eqstrainx,eqstrainy,eqstrainz,eqstrain,'linear');
[xq,yq,zq] = meshgrid(linspace(min(eqstrainx),max(eqstrainx),150), ...
linspace(min(eqstrainy),max(eqstrainy),150), ...
linspace(min(eqstrainz),max(eqstrainz),150));
t=Tin(xi,yi,zi);
s=contour3(xi,yi,zi)
colormap('jet')
s.CData=t;
colorbar
The problem with scatteredInterpolant is that the elements of the grid are distorted. What do you think? Have you got some ideas? Thank you very much.
  3 Kommentare
Andrea Sánchez Fernández
Andrea Sánchez Fernández am 29 Apr. 2020
Hi Cris:
My data are very long that's why, I have shared for example the first values. All of them are column vectors and "eqstrainx, eqstrainy,eqstrainz" are the coordinates for each element and "eqstrain" are the different values from each element. Thank you very much for your help.
eqstrainx=[-23.3057200000000
2.26728425000000
9.93073625000000
-27.4081605000000
7.86253450000000
21.8979527500000
-3.68126450000000
-11.6755737500000
31.8678900000000
-2.35368050000000
-1.01588550000000
-26.9419852500000
19.3386602500000];
eqstrainy=[-3.30960450000000
-14.2194262500000
-5.49504400000000
18.7232662500000
-11.7472085000000
-35.6955377500000
-23.4405857500000
-8.12767625000000
28.2566652500000
3.88758200000000
-23.8337300000000
-5.41057200000000
4.11215675000000];
eqstrainz=[-66.2791635000000
-95.5628890000000
-98.3438207500000
-99.3382682500000
-94.9114227500000
-55.2238302500000
-83.2415445000000
-92.4881270000000
-74.4908047500000
-108.691301250000
-70.5750062500000
-60.0032520000000
-87.5763627500000]
eqstrain=[2.47120000000000
3.10240000000000
2.64310000000000
2.45510000000000
3.08720000000000
2.20950000000000
2.63250000000000
2.87970000000000
1.29230000000000
1.67770000000000
3.15870000000000
1.95950000000000
4.16360000000000]
darova
darova am 29 Apr. 2020
I plotted the data you attached
Can you show the result you want/expect to see?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Sara
Sara am 21 Jun. 2021
Hi,
If I understand your question that you need to group the data based on its relevant strain.
I have done a similar thing but group the data based on its kind. So I had element1 and element2, and I wanted to color them based on their positions. Here is the MATLAB function that you may need to solve your problem
[Atoms, symboleS] = findgroups(symbole);
element1 = Atoms ==1;
element2 = Atoms ==2;
best of luck

Community Treasure Hunt

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

Start Hunting!

Translated by