 |
|
List Archives > 
Mathcad List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[mathcad] RE: [MathCAD] RE: Sinus regression using genfit
| [mathcad] RE: [MathCAD] RE: Sinus regression using genfit |
|
Author: Oakley, Philip SELEX UK
Posted: Mon, 20 Feb 2006 14:26:26 +0000
|
Google("zero stuffing")[2]=
<http://www.dspguru.com/info/faqs/multrate/interp.htm> http://www.dspguru.com/info/faqs/multrate/interp.htm [the 'undesired' images mentioned are the phenomena of aliasing. Probably not worth reading beyond the end of the paragraph to avoid confusion]
Zero stuffing is the digital equivalent of saying f(x) +0(x) = f(x). That is, if you add zero to the data the answer is unchanged.
In this case we have to be careful because the FFT algorithm is, in some sense, slightly 'wrong'.
When we do zero stuffing we need to tell the FFT that the number of original data points isn't the same as the number of sample point (2^n for FFT)
In Torgim's original data he only had a few data points. we can insert them into say a 256 long vector of zeros and do the FFT. All the frequencies and phases are correct (in cycles per sample width), only the amplitudes need scaling to be 256/N larger.
I often use the technique when I have a camera image whose readout is polluted by structured noise. I reconstruct the time sequence of the readout, leaving zeros where there is no time data in the image (e.g. interline times). Then FFT, rescale for number of data points, and tell the hardware engineers which frequencies are interfering and at what level, usually pointing directly the the offending item. Whith appropriate averaging and scaling you can go over many decades.
Philip
From: "Andy.Spragg" "mailto:Andy.Spragg"
Sent: Thursday, February 16, 2006 12:12 PM
To: Mathcad Discussion List
Subject: [mathcad] RE: Sinus regression using genfit
Google("zero stuffing theorem") = {} i.e. the empty set. Do tell! Andy
"Oakley, Philip (SELEX) (UK)" "philip.oakley"
16/02/2006 10:09
Please respond to
"mathcad"
To
Mathcad Discussion List "mathcad"
cc
Subject
[mathcad] RE: Sinus regression using genfit
Not looked at the attachement but...
The function looks to be effectively the result of an fourier transform, plot the maginitude and phase, taking the DC component as a3, then read of the peak frequency (~a2), the amplitude of the peak (a0) and the phase of the peak (a1.a2~2pi).
You would use the cfft/CFFT rather than fft/FFT because they cope with data lengths not 2^n. (but not irregular sampling!!)
Specifically use CFFT because this give the amplitide of a spot frequency, rather than energy density (which would apparently change the value for a spot frequency amplitude when providing a different number of samples - note the root(n) in its definition - see the help file.)
Because your data is regularly sampled (x spacing of 2) you can either use the y data directly and allow for the 2 factor yourself, or
More effectively, use zero stuffing. Because fourier analysis is additive [principle of superposition] you can add as many zeros as you like to the data.
so determine the max x value, find next 2^n, then fill in thge values you have at the right place, then do the FFT, plaoit magnitude and phase, read of values needed ( allow for 2pi radians/cycle and all that, and the first frequency on the plot is at one cycle per 2^n.
If you need finer resolution, add an extra power of 2 to 2^n. The zero stuffing theorem handles everything.
[OK so I have looked at the attachement now]
Philip
From: Torgrim Sandvoll "mailto:torgrim"
Sent: 15 February 2006 17:14
To: Mathcad Discussion List
Subject: [mathcad] Sinus regression using genfit
*** WARNING ***
This mail has originated outside your organization,
either from an external partner or the Global Internet.
Keep this in mind if you answer this message.
Hi,
Trying to fit data to the general (sinusoidal) function:
f(x,a):a0*sin(a1*(x+a2))+a3
(The periodic data for regression is often used in Norwegian highschool
math)
(See attached Mathcad (v11+) document)
Have tried with genfit, but this method seems very sensitive to the guess
values given.
Any better way to solve this problem would be appreciated!
Have a nice day! :-)
Best regards,
Torgrim Sandvoll
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
_____
Any opinions expressed in this email are those of the individual and not necessarily of RHM plc and/or any of its subsidiaries.
This email and any files transmitted with it are private, may be confidential and are for the intended recipient only. If you are not the intended recipient, be advised that you have received them in error. Please notify the sender of the error, delete all copies of them from your system and destroy any printed copies.
If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this email and any files transmitted with it.
Please rely on your own anti-virus system. No responsibility is taken by RHM plc and/or any of its subsidiaries for any damage arising out of any bug or virus infection.
_____
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
|
[View Complete Thread]
Previous by date: [mathcad] Try and get MathCad to Linux, Michael Inggs
Next by date: [mathcad] RE: about the function Find, Boekel, Tiny Van
Previous thread: [mathcad] (no subject), JSWAVELY
Next thread: [mathcad] RE: about the function Find, Boekel, Tiny Van
|
|
|