Creating a 3D surface of multiple lines

8 visualizaciones (últimos 30 días)
Alexander Engman
Alexander Engman el 6 de Abr. de 2018
Comentada: Star Strider el 6 de Abr. de 2018
Hi!
I have two variables (Vf,r) that in my code has generated values of a function (f). Vf is the volume fraction of particles and r is the radius of a particle. My code is designed to run calculations over a specified interval for Vf with a set value of r and then return the values of f. Then, it skips to the next value of r and runs the same calculations a set number of times. In the end I have something that looks like:
r =
1.0e-04 *
0.1000 0.2000 0.3000
Vfvec =
0.0010 0.0010 0.0010
0.0020 0.0020 0.0020
0.0030 0.0030 0.0030
0.0040 0.0040 0.0040
0.0050 0.0050 0.0050
0.0060 0.0060 0.0060
0.0070 0.0070 0.0070
0.0080 0.0080 0.0080
0.0090 0.0090 0.0090
0.0100 0.0100 0.0100
f =
1.6135 2.2791 2.7901
1.2143 1.7143 2.0983
1.0283 1.4512 1.7761
0.9144 1.2901 1.5786
0.8352 1.1779 1.4413
0.7758 1.0939 1.3383
0.7291 1.0278 1.2573
0.6910 0.9739 1.1914
0.6592 0.9289 1.1362
0.6321 0.8906 1.0892
If I plot all of this in 2D with Vf on the x-axis, I get a plot with three different lines, each corresponding to a certain value of r and with the correct values of f for each line. To make this more presentable, I want to plot this in 3D instead. Basically what I want is to plot the lines side by side instead of on top of each other, preferably but not necessarily creating some kind of 3D surface. How would I do this?
Many thanks in advance.
Alexander

Respuesta aceptada

Star Strider
Star Strider el 6 de Abr. de 2018
This works (in R2018a):
figure
surf(r, Vfvec, f)
grid on
xlabel('\bfr\rm')
ylabel('\bfVfvec\rm')
zlabel('\bff\rm')
view(-120, 25)
This uses the data you posted.
  2 comentarios
Alexander Engman
Alexander Engman el 6 de Abr. de 2018
This was exactly what I was looking for. Many thanks!
Star Strider
Star Strider el 6 de Abr. de 2018
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by