Getting the piecewise polynomial function of a 3D plot

조회 수: 11(최근 30일)
Senal Perera
Senal Perera 2021년 3월 16일
댓글: Senal Perera 2021년 3월 16일
Is there a method to get the piecewise function of the 3D plot below? My requirement is to get a value for X as the output when Y and Z are given as inputs. The plot is created using the curve fitting tool (linear interpolation)
Inputs should be - z , y
Output should be - x
  댓글 수: 3
DGM 2021년 3월 16일
Unless I'm missing something, this is a more fundamental problem. If your goal is to get x from y and z, you need to note that your function is overdefined. In other words, there are multiple x values that may satisfy a given y,z pair. The conceptual consequences of that fact may vary depending on your usage.

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


ANKUR KUMAR 2021년 3월 16일
편집: ANKUR KUMAR 2021년 3월 16일
You can use interp2 to calculate values programmatically.
[X,Y] = meshgrid(-5:1:5);
Z = Y.*sin(X) - 5*X.*cos(2*Y);
s = surf(X,Y,Z,'FaceAlpha',0.5);
[XX,YY] = meshgrid(-5:0.05:5);
s = surf(XX,YY,ZZ,'FaceAlpha',0.5);
s.EdgeColor = 'none';
  댓글 수: 1
Senal Perera
Senal Perera 2021년 3월 16일
I appreciate your effort Ankur. I guess interp2 is okay if z is needed as the output. But i need x as the output where z and y are inputs.

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

Community Treasure Hunt

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

Start Hunting!

Translated by