Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: fitting data to a sampled waveform?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23389] Re: [mg23355] fitting data to a sampled waveform?
  • From: Carl Woll <carlw at u.washington.edu>
  • Date: Fri, 5 May 2000 02:07:26 -0400 (EDT)
  • References: <200005040659.CAA17479@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Marrtin,

I assume you have data which you want to fit to the function

A Sin[t - t0] + B

If so, why don't you use the NonlinearFit function in the package
Statistics`NonlinearFit`? You can specify the method FindMinimum which will
carry out a least squares fit.

Carl Woll

Martin Rommel wrote:

> 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



  • Prev by Date: Re: The most efficient Fibonacci algorithim?
  • Next by Date: Re: avoid spurious vertical segment in step function plot
  • Previous by thread: fitting data to a sampled waveform?
  • Next by thread: Simple Mathematica expression Q