Plot surface from different lines

조회 수: 1 (최근 30일)
Auryn_
Auryn_ 2017년 1월 11일
댓글: Star Strider 2017년 1월 11일
Hi,
I have several plots which are in fact just lines. Now I would like to add these lines to form a surface and create a plot of this surface. How can I do that? Thanks in advance.

답변 (1개)

Star Strider
Star Strider 2017년 1월 11일
From your description, I would use the plot3 function. That is likely as close as you can get to a surface with your lines.
Consider using an interpolation function (for example scatteredInterpolant) to create a complete surface from them.
  댓글 수: 2
Auryn_
Auryn_ 2017년 1월 11일
Hi, thanks for your answer. I have tried but it does not work. Message: Vectors must be the same length. I have tried with plot3(x,y,z) where x=1x50, y=1x6 and z=6x50. Can you help me? Thanks in advance!
Star Strider
Star Strider 2017년 1월 11일
In recent MATLAB releases (I’m using R2016b), the mesh and surf functions allow you to use vectors for the independent variables, so you can just do something like this:
The Code:
x = 1:50; % Create Data
y = 1:6; % Create Data
z = rand(6,50); % Create Data
figure(1)
mesh(x, y, z)
grid on

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

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by