Re: Filter and fit experimental data



Thanks again John,

How do I do something like that? I mean I know how I could accomplish
it (I have it in my head) but im having trouble implementing, since I
dont really know how to use matlab/simulink. Again, what Id like to
do is this:

1. trigger data acquisition when theres a signal from the detector,
plot the signal as a function of time, then store everything in a
text file from the beginning.
2. when the gradient or slope of the signal is lower than 0.01 and
higher than 0.005 id like to fit the data to a second degree
polynomial (since the signal can be a bit curved sometimes) and then
extract the slope eg by derivation.
3. store the slopes in a text file.

This is the first step. Then I was planning to make this automatic in
real time, i.e. to make it so that somehow it would recognize the
slope from the beginning, then straight after the end of the signal
it would fit the curve in a separate window and plot the gradient
according to input. It could even try to recognize the function to be
fit, i.e. linear or polynomial. There would have to be some
calibration measurements done in the beginning and these would have
to be taken into account during the rest of the measurement sessions.
Then to incorporate some mathematical functions and to make it
possible to produce publication quality figures. This would be
extremely useful in my work and I estimate would cut down on analysis
time by about 90%, which means more results can be generated in less
time. Fantastic. Having to learn matlab and all that seems quite
difficult for me though, so if anyone has any help to offer, please
do so! :)

Cheers.

John D'Errico wrote:


gorkin wrote:


John,

Basically I have this set of experimental data, where I have a
spectrophotometer that monitors a reaction and produces a set
of
lines, which should have about the same gradient, every 5-10
minutes
or so. However, theres a lot of like random scatter almost
between
the lines. So I want to just pick out the lines and leave the
random
scatter. I also wanna get the gradients of those lines by
fitting
them to either a linear or polynomial equation. I wanna do this
automatically. I get my results in a txt file with time in
seconds
in
the first column and difference in absorbance int he second.
Any
suggestions? Must be too easy for most people on this forum
anyway.

This is the second post recently where
someone has wanted to fit this class
of data, with linear segments and
junk between them.

I'd suggest a Kalman filter as an
option. Estimate the parameters of
a linear model. Look for where the
uncertainty of the model parameters
gets large. This will signal the
intermediate regions. It also gives
you an estimate of the slope at each
point in time.

John
.



Relevant Pages

  • Re: lsqcurvefit
    ... This is a piecewise linear fit, ... The slope coefficient B1 is the slope in the lower ...
    (comp.soft-sys.matlab)
  • Re: An Interesting Real-World Problem...
    ... the dramatic change in gradient of: ... (wish I could include this in the post but never mind) ... piece-wise linear curve fit. ... A linear spline fit would be about the same thing and then your control ...
    (comp.soft-sys.matlab)
  • Re: Help needed
    ... signal after each linear or curved segment. ... I want to fit the linear ... model based on error values and reports the slope and error of the ...
    (comp.soft-sys.matlab)
  • Re: Polyfit
    ... weight the fit preferentially towards low x values. ... This computes the linear regression both ... parameter estimates (=slope for slope fit). ... Wikipedia, does NOT mean that it is any ...
    (comp.soft-sys.matlab)
  • fitting 2 linear functions to data?
    ... Hello, I have data which kind of looks like a mixture of two linear lines (one with a very high slope and one with a very low slope), and the question I wanted to ask is how do I fit this data a function of two linear lines. ...
    (comp.soft-sys.matlab)

Loading