Re: Fitting to a square wave
- To: mathgroup at smc.vnet.net
- Subject: [mg30521] Re: Fitting to a square wave
- From: aes <siegman at stanford.edu>
- Date: Fri, 24 Aug 2001 20:58:14 -0400 (EDT)
- Organization: Stanford University
- References: <9m53af$qir$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On Thu, 23 Aug 2001, Urijah Kaplan wrote: > > > I have a bunch of data that looks like a noisy square wave (more like a > > trapazoid actually, with it wider on the bottom) and I've been trying to > > find a consistent way to find the hight and width. I first fit a gaussian > > using NonlinearFit, but that tended to have its center shift, even if I only > > multiplied the raw data by a constant. I tried fitting to an actual square > > wave using a step function, but that didn't give me a good result either. > > Any ideas? Thanks so much. > > --Urijah Kaplan and Yasvir Avindra Tesiram <y.tesiram at pgrad.unimelb.edu.au> wrote: > Hi Urijah, > Assuming your data is symmetrical about some point x you could > try functions of the form > > f[x_]:=a * Exp[x^n/2], sort of a modified gaussian. 1) This is widely referred to in optics as a "superguassian" (and I assume you mean something like a * Exp[-b x^(2n)]. ). 2) Going further with the optics approach, you could expand this as a finite sum of Hermite-gaussians, which could take out the noise and preserve the underlying shape; and then do some analytic treatment of the resulting sum, helped by the orthogonality and other analytical properties of the HG functions.. See Siegman LASERS (Univ Sci Books, 1986) for notes on choosing the parameters of the HG expansion.