필터 지우기
필터 지우기

Creating a 3D surface of multiple lines

조회 수: 7 (최근 30일)
Alexander Engman
Alexander Engman 2018년 4월 6일
댓글: Star Strider 2018년 4월 6일
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

채택된 답변

Star Strider
Star Strider 2018년 4월 6일
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
Alexander Engman
Alexander Engman 2018년 4월 6일
This was exactly what I was looking for. Many thanks!
Star Strider
Star Strider 2018년 4월 6일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-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