How to obtain surfaces below the 3d plots

1 view (last 30 days)
Sanoop Siby
Sanoop Siby on 3 Mar 2020
Edited: Sanoop Siby on 10 Mar 2020
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.
Sanoop Siby
Sanoop Siby on 3 Mar 2020
How can i maintain the surface inside the surface

Sign in to comment.

Answers (1)

Anmol Dhiman
Anmol Dhiman on 6 Mar 2020
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.
  1 Comment
Sanoop Siby
Sanoop Siby on 10 Mar 2020
hold on
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
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
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';
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.
Sanoop Siby

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by