Thread Subject: HELP : How to find the 3 parameters that fit non linear function to data

Subject: HELP : How to find the 3 parameters that fit non linear function to data

From: Aitor Invern?n De Campos

Date: 27 Oct, 2009 16:58:08

Message: 1 of 2

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.

Subject: HELP : How to find the 3 parameters that fit non linear function to data

From: Frederic Moisy

Date: 28 Oct, 2009 07:30:03

Message: 2 of 2

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.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
fit Aitor Invernón De Campos 27 Oct, 2009 12:59:24
parameters Aitor Invernón De Campos 27 Oct, 2009 12:59:24
non linear func... Aitor Invernón De Campos 27 Oct, 2009 12:59:24
rssFeed for this Thread

Contact us at files@mathworks.com