How to Generate 3d Plot from 2 2d graphs?
25 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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])
0 个评论
另请参阅
类别
在 Help Center 和 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!