Hello.
I have a data set consisting of stresses accociated with a coordinate point (x,z). The data is attached, note that all the y coordiantes are the same, ie the stresses are on a flat surface consisting of x and z. The data for the stresses are in colum B.
I would like to create a 3D plot or surface of my stresses, but I am unsure how to associate my stresses with a specific point, so that I can plot them. I have tried using meshgrid and surf, but not with any kind of sucess worth attaching.

 채택된 답변

KSSV
KSSV 2019년 5월 1일
편집: KSSV 2019년 5월 1일

0 개 추천

Option 1: USe scatter:
[num,txt,raw] = xlsread('Data_3Dplot.xlsx') ;
num = num(9:end,:) ;
nodes = num(:,1) ;
value = num(:,2) ;
x = num(:,3) ;
y = num(:,4) ;
z = num(:,5) ;
scatter3(x,y,z,10,value,'filled')
Option 2: Make unstructured grid
[num,txt,raw] = xlsread('Data_3Dplot.xlsx') ;
num = num(10:end,:) ;
nodes = num(:,1) ;
value = num(:,2) ;
x = num(:,3) ;
y = num(:,4) ;
z = num(:,5) ;
dt = delaunayTriangulation(x,z) ;
t = dt.ConnectivityList ;
p = dt.Points ;
p(:,3) = value ;
trisurf(t,p(:,1),p(:,2),p(:,3));
view(2)
shading interp ; colorbar
Option 3: Make a structured grid
[num,txt,raw] = xlsread('Data_3Dplot.xlsx') ;
num = num(10:end,:) ;
nodes = num(:,1) ;
value = num(:,2) ;
x = num(:,3) ;
y = num(:,4) ;
z = num(:,5) ;
N = 500 ;
xi = linspace(min(x),max(x),N) ;
zi = linspace(min(z),max(z),N) ;
[X,Z] = meshgrid(xi,zi) ;
C = griddata(x,z,value,X,Z) ;
surf(X,Z,C)
shading interp ; colorbar
view(2)

댓글 수: 5

Malthe Gissel
Malthe Gissel 2019년 5월 1일
Hello
Thank you very much for taking the time to come up with all these suggestions, I greatly appreciate that! While this is not exactly what I had in mind, it definitly pushed me in the right direction.
I really like option 1, but while it obviously is a 3 dimensional coordinate system, is there any way to not use the y coordinates, and then display the stresses as a height above the plane made of x and z corrdintes?
Once again, thank you very much for your help and the quick response.
KSSV
KSSV 2019년 5월 1일
That option is already there in the solution.
[num,txt,raw] = xlsread('Data_3Dplot.xlsx') ;
num = num(10:end,:) ;
nodes = num(:,1) ;
value = num(:,2) ;
x = num(:,3) ;
y = num(:,4) ;
z = num(:,5) ;
scatter(x,z,10,value,'filled')
colorbar
Thanks is accepting the answer. :)
Malthe Gissel
Malthe Gissel 2019년 5월 2일
I dont mean to be rude, and I´m sorry if I have been unclear, but it does not solve my problem. As you can see, on the attached photos, the stress plot is a 2D color map, and not a height map. The value of the stress should specifiy the hight of the points over the surface made of x and z.
Once again thank you for your time, I will accept the answer as soon as this is solved.
KSSV
KSSV 2019년 5월 2일
That would be possible with Option 2...remove the view(2) command in there..try rotating the plot...I hope this is what you are expecting.
Malthe Gissel
Malthe Gissel 2019년 5월 2일
Thank you very much! This is exactly what I was trying to do!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

제품

릴리스

R2018b

태그

질문:

2019년 5월 1일

댓글:

2019년 5월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by