|
The Ezyfit toolbox can be used for least squares nonlinear fits, see
http://www.mathworks.com/matlabcentral/fileexchange/10176
Once the toolbox is installed, you type:
ezfit(x,[y;v], 'exp(-a*x)*sin((b*x)+c)')
and it returns the values:
a = 0.087618
b = 2.353
c = 0.32461
You can check that this fit is 'visually' correct using showfit.
See also the published file:
http://www.mathworks.com/matlabcentral/fx_files/10176/3/content/ezyfit/demo/html/efdemo.html
Frederic Moisy
"Aitor Invern?n De Campos" <aicub1@mac.com> wrote in message <hc78r0$3io$1@fred.mathworks.com>...
> First of all thanks for your attention and your help. I am working with MATLAB and i am a newbie !!!
>
> I have to solve this 2 problems :
>
> FIRST : (With Least Squares)
>
> 1.- My data is :
> x=[0:10] , this is time
> y=[0.35 0.40 -0.80 0.70 -0.10 -0.30 0.55 -0.50 0.20 0.20 -0.40] , is position
> v=[0.01 0.0025 0.0025 0.0025 0.01 0.0025 0.0025 0.0025 0.01 0.0025 0.0025]
> , is the variance of y
>
> 2.- The function to fit is : f=exp(-a*x)*sin((b*x)+c)
> where (a,b,c) are the unknown parameters to be found
>
> SECOND : (With the Maximum Likelihood Estimation, MLE)
>
> 1.- My data is :
>
> x=[0:10] this is time
> y=[1.00 1.14 1.01 0.80 0.60 0.43 0.30 0.21 0.14 0.09 0.06] this is position
>
> 2.- The function to fit is : f=exp(-(a+b)*x)*(1+(c*x))
> where (a,b,c) are the unknown parameters to be found
>
>
> Wich is the best way to proceed in MATLAB on both cases? If someone help me,
> please,explain in detail the process if you have the time because i am lost.
>
> THANKS A LOT !!!
>
> PD: Sorry about my English and my ignorance.
|