 |
|
List Archives > 
Mathcad List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[mathcad] Re: Sinus regression using genfit
| [mathcad] Re: Sinus regression using genfit |
|
Author: William J Marshall
Posted: Wed, 15 Feb 2006 13:14:12 -0500
|
Switching to the Optimized L-M method produced results for me (using V13),
but apparently having a choice of solution algorithm is not available in
V11.2.
- Bill
"Torgrim
Sandvoll"
<torgrim@sandvoll To
.com> Mathcad Discussion List
"mathcad"
02/15/2006 12:14 cc
PM
Subject
[mathcad] Sinus regression using
Please respond to genfit
"mathcad"
ptscience.com
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
[attachment "SINUSregresjon.mcd" deleted by William J
|
| [mathcad] RE: Sinus regression using genfit |
|
Author: Pergande, Albert N
Posted: Wed, 15 Feb 2006 14:14:16 -0500
|
You might try an fft - re- multiply so it's a*sin(bx+c)+d. The 0 bin is
d, the bin number of the peak is b, the magnitude of the peak is a (plus
or minus a 2 pi or an "N") and the phase you can estimate once you know
the frequency. Should work if you have a full cycle or more.
Al Pergande
Senior Radar Engineer
Lockheed Martin Missiles and Fire Control
MP 200
5600 Sandlake Road
Orlando, Fl 32819
Voice 407-356-5169
Fax 407-356-0933
"albert.n.pergande"
for personal mail - "al"
From: Torgrim Sandvoll "mailto:torgrim"
Sent: Wednesday, February 15, 2006 12:13 PM
To: Mathcad Discussion List
Subject: [mathcad] Sinus regression using genfit
Hi,
Trying to fit the general function: f(x,a):a0*sin(a1*(x+a2))+a3
(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
|
| [mathcad] RE: Sinus regression using genfit |
|
Author: Oakley, Philip SELEX UK
Posted: Thu, 16 Feb 2006 10:09:02 +0000
|
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.
********************************************************************
|
| [mathcad] RE: Sinus regression using genfit |
|
Author: Potter, Mick
Posted: Thu, 16 Feb 2006 11:21:30 -0000
|
Hi,
My guess is that, without good initial guesses, this could be difficult
to solve with any method. The most sensitive parameter is a1, which
determines the frequency. I'm sure there are a large number of high
frequency sine waves that would pass through or close to all the points
(remember the textbook pictures of undersampled sine waves?).
I attach a file (ver 11.2a) that analyses the data to get reasonable
first guesses, and then uses Minerr to find a solution, although I'm
sure Genfit or any other technique should be OK given these values.
HTH
==
Mick
|From: Torgrim Sandvoll "mailto:torgrim"
|Sent: 15 February 2006 17:14
|To: Mathcad Discussion List
|Subject: [mathcad] Sinus regression using genfit
|
|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 has been scanned by the MessageLabs Email Security System.
|For more information please visit http://www.messagelabs.com/email
|______________________________________________________________________
|
|
Attachments:
SINUSregresjon 2.mcd
|
| [mathcad] RE: Sinus regression using genfit |
|
Author: Andy Spragg
Posted: Thu, 16 Feb 2006 12:12:26 +0000
|
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.
****************************************************************
|
| [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.
********************************************************************
|
Previous by date: [mathcad] Sinus regression using genfit, Torgrim Sandvoll
Next by date: [mathcad] RE: Sinus regression using genfit, Pergande, Albert N
Previous thread: [mathcad] RE: about the function Find, Boekel, Tiny Van
Next thread: [mathcad] Re: Sinus regression using genfit, William J Marshall
|
|
|