extrapolating data points/surface between two 3D lines

조회 수: 8 (최근 30일)
John
John 2014년 7월 28일
댓글: Star Strider 2014년 7월 29일
Hello all! I have two data sets (x,y,z1) (x,y,z2) where x, y and z are all seperate vectors of length n. I can plot each data set together as a 3D line plot using: plot3(x,y,z1,x,y,z2), but I would also like to interpolate/extrapolate the linear surface which exists between these two lines, effectively creating a 3D surface plot. Is there a good way to do this?

답변 (1개)

Star Strider
Star Strider 2014년 7월 28일
Without seeing your data, it’s difficult to be specific. See if griddata (or its friends) will do what you want.
  댓글 수: 2
John
John 2014년 7월 29일
편집: Star Strider 2014년 7월 29일
The data is nothing special really, simply two 3D lines with equal number of points. for example
x = [ 1 2 3 ];
y = [ 1 2 3 ];
z1 = [ 4 4 5 ];
z2 = [ 1 2 8 ];
where line 1 is described by the points x,y,z1 and line 2 is described with the points x,y,z2. THe idea here is to create a surface between these lines.
Star Strider
Star Strider 2014년 7월 29일
The problem (that I didn’t appreciate before) is that (z1, z2) are defined at the same points. If you plot them using stem3, z1 are simply plotted on the same stems as z2.
If x and y are actually the same (as they are in your example), I suggest you use a 2D plot, such as the area plot to get the effect you want.
I suggest you experiment with patch for a 3D version of it. The patch function requires some experimentation to get it to do what you want.
Examples:
figure(1)
patch(x, y, [ z1; z2 ], 'g')
grid
view([15 30])
figure(2)
patch([0 x 0], [0 y 0], [0 z1 0; z1(1) z2 z2(3)], 'b')
grid on
view([15 30])

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

카테고리

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