Borrar filtros
Borrar filtros

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

8 visualizaciones (últimos 30 días)
Bumjun
Bumjun el 22 de Mayo de 2023
Respondida: Nathan Hardenberg el 22 de Mayo de 2023
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

Respuestas (1)

Nathan Hardenberg
Nathan Hardenberg el 22 de Mayo de 2023
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])

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by