Xref: utzoo comp.dsp:127 rec.audio:15627 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!rutgers!cmcl2!lanl!opus!ted From: ted@nmsu.edu (Ted Dunning) Newsgroups: comp.dsp,rec.audio Subject: Re: Sine curve fit algorithms Message-ID:Date: 29 Sep 89 00:27:35 GMT References: <2421@radio.oakhill.UUCP> <1989Sep28.161516.10353@rpi.edu> Sender: news@nmsu.edu Followup-To: comp.dsp Organization: NMSU Computer Science Lines: 30 In-reply-to: wrf@mab.ecse.rpi.edu's message of 28 Sep 89 16:15:16 GMT In article <1989Sep28.161516.10353@rpi.edu> wrf@mab.ecse.rpi.edu (Wm Randolph Franklin) writes: In <2421@radio.oakhill.UUCP> charlie@oakhill.UUCP (Charlie Thompson) writes: >I am looking for C source code for sine wave curve fitting algorithms. Such an algorithm can be >used to compute THD/Noise in a digitized sine wave. For simplicity a Taylor series would be ok. However, here is a fourth order Chebyshev series that is much faster for the accuracy. It finds sin(y) for y from 0 to Pi/2 with a max error of 0.000124. This was obtained with Maple. wrf missed the point entirel, i think. what charlie was wanting is a way to compute the amount of distortion present in a digitized sine wave. happily, what he wants is relatively easy to provide. the fourier transform does exactly the right thing. in the discrete time case, you will have to either sample for a long time, or know the freqency of the original sine wave very accurately. so... the answer to the question is to computer the fourier transform, eliminate the coefficient corresponding to the sine wave you are interested in and compute the total power in the rest of the spectrum. -- ted@nmsu.edu remember, when extensions and subsets are outlawed, only outlaws will have extensions or subsets