Curve Fitting (polynomial fitting and interpolation)

Hello,
I am working on surface fitting of data. I am using "fit" function to perform polynomial fitting and interpolation for surface fitting. It is very sucessfull and i have no problem with it.
I have also used "griddata" for linear interpolation. This method is also very sucessfull.
While using "griddata", when i need to find the unknown z(z_req) from known x(x_req) and y(y_req), i use the below piece of code to do it :
x_req=0.8668;
y_req=0.1114;
z_req= griddata(xnew,ynew,znew,x_req,y_req,'linear');
it gives me the value for z , it is working fine.
Now i need to find the unknown z by using "fit" function, and i was not yet able to do it like i did with "griddata".
Is there any method to find the unknown z with the help of "fit" function in surface fitting?

1 Comment

I am using "fit" function to perform polynomial fitting and interpolation for surface fitting.
Your terminology is confusing. Curve fitting and interpolation are different things.

Sign in to comment.

Answers (1)

Matt J
Matt J on 5 Jul 2019
Edited: Matt J on 5 Jul 2019
fit() will return a fitobject, which you can use to evaluate the surface at any point you wish
zq=fitobject(xq,yq)
It's important to understand that zq is is the value of the fitted surface at the point [xq,yq]. It is not an interpolated value, because the surface may not pass through the points you used to perform the fit.

Categories

Products

Release

R2018a

Asked:

on 25 Jun 2019

Edited:

on 5 Jul 2019

Community Treasure Hunt

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

Start Hunting!