Computing 3d plot with three AxBxC arrays
古いコメントを表示
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 件のコメント
You can only plot 2D matrices with surf and contour. Here I simply ‘stacked’ the surf plots. You can do something similar with the contour plots, although they will likely have to be plotted in different figures, however the matrices are constant here so the contour plots will not be drawn.
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)
% QQx
% QQy
% Axx
hold on
for k = 1:size(Axx,3)
surf(QQx(:,:,k),QQy(:,:,k),Axx(:,:,k));
end
hold off
view(30,30)
xlabel('Qx');
ylabel('Qy');
zlabel('Accidental eccentricity (m)'); % burasinin Accidental eccentricity olmasinin sebebi e=0 olarak almamizdan kaynaklanmaktadir.
% shading interp
colorbar
figure (4)
for k = 1:size(Axx,3)
contour(QQx(:,:,k),QQy(:,:,k),Axx(:,:,k),30);
end
xlabel('Qx');
ylabel('Qy');
zlabel('Accidental eccentricity (m)'); % burasinin Accidental eccentricity olmasinin sebebi e=0 olarak almamizdan kaynaklanmaktadir.
% shading interp
colorbar
.
Osman AKYUREK
2023 年 8 月 22 日
移動済み: Star Strider
2023 年 8 月 22 日
Osman AKYUREK
2023 年 8 月 22 日
移動済み: Star Strider
2023 年 8 月 22 日
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).
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

