How to obtain surfaces below the 3d plots

1 visualización (últimos 30 días)
Sanoop Siby el 3 de Mzo. de 2020
Editada: Sanoop Siby el 10 de Mzo. de 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
2 comentariosMostrar 1 comentario más antiguoOcultar 1 comentario más antiguo
Sanoop Siby el 3 de Mzo. de 2020
How can i maintain the surface inside the surface

Iniciar sesión para comentar.

Respuestas (1)

Anmol Dhiman el 6 de Mzo. de 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.
Thanks
1 comentarioMostrar NingunoOcultar Ninguno
Sanoop Siby el 10 de Mzo. de 2020
Editada: Sanoop Siby el 10 de Mzo. de 2020
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
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

Iniciar sesión para comentar.

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by