MATLAB Answers


Curve fitting function (fit) error

Asked by sepideh
on 2 Nov 2012
Latest activity Commented on by Susarla
on 5 Feb 2015

I am using function "fit" to fit a surface to my data. I have a 3 dimentional data , z(x,y). I use the function as below: surfacefit=fit([x y],z,'polyll') I am sure both my x and y are column matrix and have the same dimension. But i get this error : Error using fit>iFit (line 133) Y must be a column vector.

Error in fit (line 109) [fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...



No products are associated with this question.

1 Answer

Answer by Walter Roberson
on 2 Nov 2012
surfacefit=fit([x(:), y(:)],z(:),'polyll') 


Hi, thanks for the answer, but i still get the same error.

Many Thanks for this answer

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!