Clear Filters
Clear Filters

Computing 3d plot with three AxBxC arrays

2 views (last 30 days)
Hi All,
I am working on a project and I have computed data like given in the code below. If the data is 2 by 2, I can get a 3d graph, but my data are 3 dimensional. I want to get a graph in which the first axis is 'Qx' the second 'Qy' and the third one should be 'ed' or 'Ax'. Please check out the code, you will understand what I meant. Any help will be appreciated. Thanks in advance.
Best regards,
OA
% cift for loop ile meshgrid komutu yazildi. Cooooookkk Onemlliiiii
% As=Lx/Ly % Aspect ratio of the building
% Lx=35
% Ly=[1:3:100];
% As=Lx./Ly
j=1;
k=1;
l=1;
Lx=1;
Ly=1;
Ax=1;
As=1;
e=0;
for Ax=0.7:0.1:3;
for Qx=0:0.1:2.5;
for Qy=0:0.1:2.5;
edx(k,j,l)=(((Qy*(sqrt(((As^-2+1)*(Lx)^2)/12)+e))^2)/Lx)*((1.2*(Ax^0.5)-1)/(0.6*(Ax^0.5)));
edy(k,j,l)=(((Qx*(sqrt(((As^2+1)*(Ly)^2)/12)+e))^2)/Ly)*((1.2*(Ax^0.5)-1)/(0.6*(Ax^0.5)));
ed(k,j,l)=sqrt(edx(k,j).^2+edy(k,j).^2);
Axx(k,j,l)=Ax;
QQx(k,j,l)=Qx;
QQy(k,j,l)=Qy;
Axx(k,j,l)=Ax;
k=k+1;
end
k=1;
j=j+1;
end
j=1;
l=l+1;
end
figure (3)
surf(QQx,QQy,Axx);
xlabel('Qx');
ylabel('Qy');
zlabel('Accidental eccentricity (m)'); % burasinin Accidental eccentricity olmasinin sebebi e=0 olarak almamizdan kaynaklanmaktadir.
% shading interp
colorbar
figure (4)
contour(QQx,QQy,Axx,30);
xlabel('Qx');
ylabel('Qy');
zlabel('Accidental eccentricity (m)'); % burasinin Accidental eccentricity olmasinin sebebi e=0 olarak almamizdan kaynaklanmaktadir.
% shading interp
colorbar
  4 Comments
Osman AKYUREK
Osman AKYUREK on 22 Aug 2023
Moved: Star Strider on 22 Aug 2023
Thank you for your quick response. It works.
Star Strider
Star Strider on 22 Aug 2023
My pleasure!
I did not post it as an Answer because I was not certain it was what you wanted, especially with respect to the contour plots (that cannot exist for constant matrices).

Sign in to comment.

Accepted Answer

Steven Lord
Steven Lord on 22 Aug 2023
Based on what Star Strider posted and looking at the Types of MATLAB Plots page in the documentation (which is also available in a slightly different form in the Plots tab in the Toolstrip) it seems like slice or contourslice or perhaps contour3 will be of use to you. [The isosurface function should probably be in this list as well, in the Volume Visualization or Contour Plots sections. I'll note that to the documentation staff.]

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!