fitting data to a sampled waveform?
- To: mathgroup at smc.vnet.net
- Subject: [mg23355] fitting data to a sampled waveform?
- From: "Martin Rommel" <Martin_Rommel at mac.com>
- Date: Thu, 4 May 2000 02:59:22 -0400 (EDT)
- Organization: Semitest
- Sender: owner-wri-mathgroup at wolfram.com
I have a waveform given as sample data. Then I have another related waveform
which I want to least-square-fit to it. Initially using phaseshift,
amplitude (amplification) and (DC-)offset as fit parameters will do.
By playing I can manually find offset, phase and amplification easily
(assuming that the moments of the two distributions correspond the offset
is the difference of the means and the amplification is the ratio of the
standard deviation, but I don't think that this amounts to a least square
fit). For the phase one could relate extrema or other easily identifiable
features. As soon as the data get noisy or distorted all that becomes tricky
and ill-defined.
Probably I can use an InterpolatingFunction as model for Fit but that seems
to be a detour since for the actual fit discrete values are calculated. The
advantage would be, however, that I could get a phase with higher accuracy
than the sampling period. I already wrote a simple fractional Rotate for
that allows to phase shift the two waveforms:
fracRotate[lst_List, d_] :=
With[{fp = Abs[FractionalPart[d]] , s = Sign[d]},
((1 - fp)RotateRight[lst, s Floor[Abs[d]]] + fp RotateRight[lst, s
Ceiling[Abs[d]] ])];
Any comments, references, ideas?
Martin
- Follow-Ups:
- Re: fitting data to a sampled waveform?
- From: Carl Woll <carlw@u.washington.edu>
- Re: fitting data to a sampled waveform?