Least quares to fit a surface

Joined
8/11/11
Messages
124
Points
278
Hi guys,

I face the following problem:

I want to fit a function to a surface by using a least squares algorithm. I've done my toy model in Matlab and I use the funcion lsqnonlin.

However, now I want to code it in C++ and honestly I dónt know how to do it. After some research, I found the MINPACK library, with some examples and it seems it could work. However, I'd like to hear your suggestions.

In the end, I need to fit an implied vol surface by using a function like

y=x(1)+x(2)*MN+x(3)*MN.^2+x(4)*T+x(5)*T.*MN+x(6)*T.^2;

Thank you for your help!
 
Back
Top Bottom