フィルターのクリア

How to Generate 3d Plot from 2 2d graphs?

16 ビュー (過去 30 日間)
Bumjun
Bumjun 2023 年 5 月 22 日
回答済み: Nathan Hardenberg 2023 年 5 月 22 日
Hello everyone
I would like to generate a 3d mesh plot from two 2d graphs.
  • first 2d graph:
x1 = normalized time, y1 = normalized resistance
  • second 2d graph:
x2 = normalized time, y2 = normalized stress
first and second 2d graphs would be the side of the 3d mesh.
top view of the 3d plot would be plot of y1 and y2
the final result would be the crossing of the two 2d graphs

回答 (1 件)

Nathan Hardenberg
Nathan Hardenberg 2023 年 5 月 22 日
To plot a 3D-Surface/mesh you need a function that is dependent on two variables (https://de.mathworks.com/help/matlab/ref/meshgrid.html). Normally the result is then plotted on the z-axis. Your two functions seem to only have the time as an input. Plotting this as a surface would not work (or at least would not make sense).
If you have a function with two variables, check the link of the Matlab documentation I provided.
The following code shows how you could do something like you discribe, but without a mesh/surface. Note that the z-axis now shows values for y1 and y2.
x = linspace(0,10,10);
y1 = rand(1,10);
y2 = rand(1,10);
zerosVec = zeros(1,10);
figure(1); hold on; grid on;
plot3(x, zerosVec, y2)
plot3(zerosVec, x, y1)
xlabel('x')
ylabel('x')
zlabel('y1 or y2')
view([-25.10 33.53])

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by