Computing 3d plot with three AxBxC arrays

조회 수: 3 (최근 30일)
Osman AKYUREK
Osman AKYUREK 2023년 8월 22일
답변: Steven Lord 2023년 8월 22일
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
Osman AKYUREK
Osman AKYUREK 2023년 8월 22일
이동: Star Strider 2023년 8월 22일
Thank you for your quick response. It works.
Star Strider
Star Strider 2023년 8월 22일
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).

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

채택된 답변

Steven Lord
Steven Lord 2023년 8월 22일
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.]

추가 답변 (0개)

카테고리

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