Thread Subject: Log curve fitting

Subject: Log curve fitting

From: Silvana

Date: 6 Jul, 2009 23:55:02

Message: 1 of 2

Hi
I have a 2D plot and would like to find the best curve fit in a specific range of my data set. How could I do it without the Curve Fitting Toolbox?
Cheers,
Silvana

Subject: Log curve fitting

From: Miroslav Balda

Date: 7 Jul, 2009 04:43:02

Message: 2 of 2

"Silvana " <sillbr@gmail.com> wrote in message <h2u2sm$t61$1@fred.mathworks.com>...
> Hi
> I have a 2D plot and would like to find the best curve fit in a specific range of my data set. How could I do it without the Curve Fitting Toolbox?
> Cheers,
> Silvana

Hi Silvana
It depends on the function to be fitted. Let assume, due to the subject, that you wish to fit the data x, y by a function
    log10(y) = p(1)+ p(2)*log10(x),
where unknown parameters are p = [p(1); p(2)]. The above function is linear in parameters p. Normal equations sound
    A*p = b,
where the system matrix A is
    A = [ones(size(x)), log10(x)],
and the vector of righthand sides
    b = log10(y).
Its solution is
    p = A\b;
Now, you may plot it by
   loglog(x,10^p(1)*x.^p(2))
Hope it helps

Mira

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
log fit Miroslav Balda 7 Jul, 2009 00:44:08
rssFeed for this Thread

Contact us at files@mathworks.com