Re: Fitting Data



Robert wrote:
"John D'Errico" <woodchips@xxxxxxxxxxxxxxxx> wrote in
message <fhfiha$lro$1@xxxxxxxxxxxxxxxxxx>...
"Robert " <robert.sochon@xxxxxxxxxxxxxxxxxx> wrote in
message <fhfgen
$nif$1@xxxxxxxxxxxxxxxxxx>...
I have some noisy(ish) data from an experiment, I would like
to plot this data and plot a line of best fit through it! -
easyish - I think!

My data is long and messy, but It should follow the
equation,
y = k * x ^ (3/2)

The problem is the 3/2 and the fact that it should lack a
constant. polyfit gives me hassle, but I think I have
managed it. I have tried logging the data too, and this just
only confuses me.
If x and y are columns, and x is non-negative

k = (x.^(3/2)) \ y;

John


Sorry - I'm confused, I can calculate 'k' just that deciding
when K deviates from the data is now the problem, I suppose
you could write the question as "what is the data sample
length that fits the curve y =k*x(3/2)?" - this leaves two
unknows! - "k" and a the length of "x".

My curve starts off with a curving section upwards, and then
turns to a straight line, by plotting R i can work out when
the curve ceases to be a straight line (downwards from the
top), but working upwards to where the curve stops fitting
the initial equation and turns to the transition region is
proving more difficult.

Sorry... I think my question wasn't clear enough!

That would be an iterative procedure then -- if you don't need to have it fully automated, I'd start by plotting the data to visually select a starting breakpoint.

After that, you would have to fit the two sections, compute the overall residual, and move the breakpoint one direction or the other and repeat until you locate a minimum.

There are procedures for this, whether any are implemented in the Matlab Statistic and/or Curve Fitting toolbox(es) or not, I don't know; or, of course, whether you have either. A common-enough problem that might have some code at the Code Exchange, too.

--
.



Relevant Pages

  • Re: identify separate weighted probability plots
    ... Anyway, the probability plot is bi-modal and I would like to fit separate weighted curves to the peaks, plot, and have some sort of confidence number plotted and displayed. ... I believe you want to treat this as a distribution fitting problem instead of creating a histogram and fitting a curve to the bar heights. ...
    (comp.soft-sys.matlab)
  • Re: Curve fit to 3D data
    ... "Thomas " wrote in message ... My objective is to find a best fit curve to match the points in my matrix and then plot the points using scatter3 and the fit curve in one plot. ...
    (comp.soft-sys.matlab)
  • Re: Curve fit to 3D data
    ... "Thomas " wrote in message ... > My objective is to find a best fit curve to match the> points in my matrix and then plot the points using scatter3 and the fit> curve in one plot. ...
    (comp.soft-sys.matlab)
  • Re: Least Square fitting
    ... I plot ... the data and fit a "rough" curve to it and found that the intercept of ...
    (sci.math)
  • Only 7.8 Billion (was: 9 Billion. The Population Explosion Is At And End.)
    ... This does, in fact, fit very well. ... deviations of about 10-20 million and is not a direct fit. ... The results of fitting this to the above-mentioned regularity ... surprising recent development in the world population curve. ...
    (sci.anthropology)