How to convert 3D plot to 2D plot

4 ビュー (過去 30 日間)
OriAlpha
OriAlpha 2018 年 11 月 28 日
回答済み: Gautam 2024 年 10 月 23 日
Hello,
i have a matrix of 3 * 3 i have plotted into 3Dgraph but i need to convert to 2D graph
so can anyone help me
  2 件のコメント
madhan ravi
madhan ravi 2018 年 11 月 28 日
編集済み: madhan ravi 2018 年 11 月 28 日
upload your matrix datas as .mat file
OriAlpha
OriAlpha 2018 年 11 月 28 日
Hello,
i am uploading the file

サインインしてコメントする。

回答 (1 件)

Gautam
Gautam 2024 年 10 月 23 日
Hello @OriAlpha,
I assume that you wish to project your 3D plot on a 2D plane.
You can follow the code below to project your plot on XY, YZ or ZX plane
theta = linspace(0, 2*pi, 100);
x = cos(theta);
y = sin(theta);
z = theta;
% Plot the original 3D data
figure;
subplot(2, 2, 1);
plot3(x, y, z, 'b', 'LineWidth', 2);
xlabel('X');
ylabel('Y');
zlabel('Z');
title('3D Plot');
grid on;
axis equal;
% Project onto the XY plane (ignore z)
subplot(2, 2, 2);
plot(x, y, 'r', 'MarkerSize', 10);
xlabel('X');
ylabel('Y');
title('Projection onto XY Plane');
grid on;
axis equal;
% Project onto the XZ plane (ignore y)
subplot(2, 2, 3);
plot(x, z, 'g', 'MarkerSize', 10);
xlabel('X');
ylabel('Z');
title('Projection onto XZ Plane');
grid on;
axis equal;
% Project onto the YZ plane (ignore x)
subplot(2, 2, 4);
plot(y, z, 'm', 'MarkerSize', 10);
xlabel('Y');
ylabel('Z');
title('Projection onto YZ Plane');
grid on;
axis equal;
This is the output the code generates

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by