From: Paolo on
Hello,
I am wondering if someone can help me to fix a problem I am having in financial mathematics.

I have a myfun() implemented and I want to calibrate its parameters to some data.
myfun() has the following form:

myfun(X,T)=a+b*exp(c*T)+d*X+e*X^2+f*X^3

the data with which I want to fit myfun is a surface. I mean I have a matrix A[nxm] defining the surface values and I have two vectors B[1xm] and C[nx1] which defines the axes values of the matrix A.

Any suggestion to solve this problem is well appreciated,

Thank you in advance
From: Branko on
"Paolo " <tarpanelli(a)libero.it> wrote in message <hgshb1$d8s$1(a)fred.mathworks.com>...
> Hello,
> I am wondering if someone can help me to fix a problem I am having in financial mathematics.
>
> I have a myfun() implemented and I want to calibrate its parameters to some data.
> myfun() has the following form:
>
> myfun(X,T)=a+b*exp(c*T)+d*X+e*X^2+f*X^3
>
> the data with which I want to fit myfun is a surface. I mean I have a matrix A[nxm] defining the surface values and I have two vectors B[1xm] and C[nx1] which defines the axes values of the matrix A.
>
> Any suggestion to solve this problem is well appreciated,
>
> Thank you in advance

Could you be more specific. What are you looking for- parameters (a,b,c,d...). If so what are T and S in your problem.

Branko
From: John D'Errico on
"Paolo " <tarpanelli(a)libero.it> wrote in message <hgshb1$d8s$1(a)fred.mathworks.com>...
> Hello,
> I am wondering if someone can help me to fix a problem I am having in financial mathematics.
>
> I have a myfun() implemented and I want to calibrate its parameters to some data.
> myfun() has the following form:
>
> myfun(X,T)=a+b*exp(c*T)+d*X+e*X^2+f*X^3
>
> the data with which I want to fit myfun is a surface. I mean I have a matrix A[nxm] defining the surface values and I have two vectors B[1xm] and C[nx1] which defines the axes values of the matrix A.
>
> Any suggestion to solve this problem is well appreciated,

This is NOT a polynomial model that you describe.
It is a nonlinear model. Start with

help meshgrid

to build the independent variables for the model.

then you might use the optimization toolbox tools
lsqcurvefit or lsqnonlin, or the curvefitting toolbox
to do the fitting. If you have the stats toolbox, then
nlinfit will do it. You could also use fminspleas from
the file exchange. fminspleas may be more robust
and almost certainly faster than the alternatives for
this model, since there is only one nonlinear
parameter.

http://www.mathworks.com/matlabcentral/fileexchange/10093

HTH,
John