How to obtain surfaces below the 3d plots

조회 수: 1 (최근 30일)
Sanoop Siby
Sanoop Siby 2020년 3월 3일
편집: Sanoop Siby 2020년 3월 10일
Hi Everyone,
Here you can see that i have a made a serios of 2d plots in 3d space to show the variation of stress along cross section.
How can i make a surface below each curve
Thanks in advance.
  댓글 수: 2
Sanoop Siby
Sanoop Siby 2020년 3월 3일
How do i maintain the surface within the plots
Sanoop Siby
Sanoop Siby 2020년 3월 3일
How can i maintain the surface inside the surface

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

답변 (1개)

Anmol Dhiman
Anmol Dhiman 2020년 3월 6일
Hi Sanoop,
You can create surface plots using surf(link). The above problem can be solved using different colors for each plot.
You can refer to link for having different colors.
Thanks
  댓글 수: 1
Sanoop Siby
Sanoop Siby 2020년 3월 10일
편집: Sanoop Siby 2020년 3월 10일
figure
hold on
j=5
for i = 11:2:12
XLoc = HMatrix(:,i) % first column in excel data
YStress = HMatrix(:,i+1) % second column in excel data
ZHigh = zeros(size(HMatrix(:,i)))+AxzH(j) % j is just a scalar number for heights
x=[XLoc;flip(XLoc)] % plot points on graph with axis (x,y)
y=[YStress ; flip(zeros(size(YStress)))] % plot points (x,0)
z =[ZHigh;flip(ZHigh)] % heights
[X,Y] = meshgrid(0:2:160,0:0.1:16)
IN =inpolygon(X,Y,x,y) % Create polygon with ploted points
X(~IN)=[]; % remove points mesh grid points outside polygon from X
Y(~IN) = []; % remove points mesh grid points outside polygon from Y
Z = zeros(size(X))+AxzH(j) % create appropriate Z values hieghts
X = reshape(X,[7,263]) % just a trial to make Z a matrix
Y = reshape(Y,[7,263]) % just a trial to make Z a matrix
Z = reshape(Z,[7,263]) % just a trial to make Z a matrix
disp(size(X))
disp(size(Y))
disp(size(Z))
sur = surface(X,Y,Z) % this works only if Z is a matrix
% T = delaunay(X,Y);
% trisurf(T,X,Y,Z) % also tried Trisurf but error points are collinear
shading interp
pH= plot3(XLoc, YStress,ZHigh);
pH.LineWidth = 2;
plot3(X,Y,Z,'o') % gives perfect results
end
title('Shear-Stress distribution along width of beam section')
xlabel(' Distance along width of beam')
ylabel('Stress values')
zlabel('Depth of beam')
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
ax.ZAxisLocation = 'origin';
view(3)
grid on
hold off
Hi Anmol thanks for the reply. But my problem is a bit different.
I have created these graps using a for loop.
My query is very similar to this
I have X and Y vectors. I want to have a surface. Surf requires Z to be a matrix. If i use gridata Z will still be a vector. If i use Tri surf Then it gives points are collinear.
Is there any way to tackle ths problem and create surface.
Thanks,
Sanoop Siby

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

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by