How to find an equation to fitting surface?

조회 수: 4 (최근 30일)
BB
BB 2012년 10월 23일
답변: Valter Zöldhegyi 2019년 5월 7일
I have a 100x100 matrix, which contains 10000 different values
Use of imagec instruction drawing as follows
I want to find an equation to fitting this surface
How to do?
Thanks~!!
  댓글 수: 2
Matt J
Matt J 2012년 10월 23일
The surface doesn't look like a plane to me. Are you sure that's how you want the fit to model it. If not, why does your title say that you're fitting a plane?
BB
BB 2012년 10월 23일
sorry, I change my title as fitting a surface.

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

답변 (2개)

Matt J
Matt J 2012년 10월 23일
If you have the Curve Fitting Toolbox, you should probably look at CFTOOL.
  댓글 수: 2
BB
BB 2012년 10월 23일
I have been try to use CFTOOL
But I don't know how to put my starting value
Is X data put [1 100], Y data put [1 100], Z data put this matrix?
Matt J
Matt J 2012년 10월 23일
No, length(X) must be the same as size(Z,2) and length(Y) must be the same as size(Z,1)

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


Valter Zöldhegyi
Valter Zöldhegyi 2019년 5월 7일
Without toolbox: you can use the polyfitn function by John D'Errico: https://www.mathworks.com/matlabcentral/fileexchange/34765-polyfitn
Considering your example:
myIn = NaN(10000, 3);
myIn(:,1) = repmat((0:1:99, 1, 100); %x
myIn(:,2) = repelem(0:1:99, 100); %y
myIn(:,3) = myData(:); % z, myData is the 100x100 matrix you have
myModel = polyfitn([myIn(:,1),myIn(:,2)],myIn(:,3),4); % x and y is the depending variable, z is the independant variable, 4 is the degree of the polynom
In the myModel struct you will have the ModelTerms and the Coefficients fields. ModelTerms matrix defines the term used (eg. a row with [0 0] means a constant; row [1 1] is a x*y term). The coefficients for each term can be found in the Coefficients vector.

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by