home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
-
-
-
-
- __________________________________________________
-
- CRUNCHER (v2.2)
- __________________________________________________
-
- Copyright 1992, 1993 by Gene V. Wallenstein
- All rights reserved.
-
- Last revision: 04/10/93
-
- -
-
-
- Software for Science and Engineering
-
- Gene V. Wallenstein
- 5990 Pine Cone Court #406d1
- Lake Worth, Florida 33463 USA
-
- CompuServe 75110,77
- Telephone (407) 750-3527
- Internet - Wallenstein@Walt.ccs.fau.edu
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1. Introduction and System Requirements
-
- The CRUNCHER is a series of signal processing routines written for C
- programmers. The libraries can be linked with both Borland and Microsoft
- code and come in a number of memory sizes. The following routines are
- included in the CRUNCHER:
-
- 1) Fast Fourier Transform (FFT)
- 2) Wavelet Transform
- 3) Coherence Analysis
- 4) Autocovariance
- 5) Crosscovariance
- 6) Spectral Analysis
- 7) Cross Spectral Analysis
- 8) Linear Regression
- 9) Moments Analysis
- 10) Digital Filtering of data
- 11) Wigner-Ville Transform
-
-
- 2. Registration
-
- The CRUNCHER is distributed through a unique marketing
- concept
- called "shareware". The idea behind shareware is that you
- get the software and try it for a short grace period and if
- you intend to use it beyond that you register your copy with
- the author. The entire concept is based on an honor system
- among programmers and users, which has led to an outstanding
- base of high quality software without the high price usually
- associated with it. Also, shareware users are in the unique
- position of being able to contact the authors of the
- software they are using and get direct support in the form
- of manuals, phone help, and possible further customization
- of the software. Please read the list of added features you
- will receive when you become a registered user of the
- CRUNCHER.
-
- 2.1.1. Source code
-
- All registered users get complete source code for the
- CRUNCHER.
-
- 2.1.2. Free updates
-
- Regstered users pay once and get all updates free. The only
- charge is
- for postage and handling. There are NO EXTRA COSTS.
-
- 2.1.3. User's Manual and Tutorial
-
- A laser-printed user's manual and tutorial which is actually
- and expanded version of section 3 of this file will be given
- to all registered users. This manual includes various
- examples of data analysis and explains which techniques are
- best in certain circumstances and the type of information
- which can be obtained from such methods.
-
- 2.1.4. Direct Support
-
- All registered users of the CRUNCHER will receive full
- support
- either over the telephone, internet, or via the regular
- mail, by using one of the contact points on the cover of
- this document. This information is also listed on the first
- information screen of the demo program as well.
-
- 2.1.5. Royalty free
-
- Registered users of the CRUNCHER pay no additional
- royalties.
-
-
- 2.2. Legal Stuff
-
- 1) License - The user is granted the right (and encouraged)
- to copy this unregistered version and distribute it with no
- charge assuming it is unaltered. The user is also granted a
- grace period of 30 days in which to decide to register the
- software or not. During this grace period the software may
- be used free of charge.
-
- 2) Copyright - The CRUNCHER is protected under United
- States
- copyright law and international treaty provisions. Copyright
- 1993 by Gene V. Wallenstein; All rights reserved.
-
- 3) Reverse Engineering - Any form of reverse engineering
- such as reverse compiling or disassembly is strictly
- prohibited.
-
- 4) Disclaimer of Warranty - This software and manual are
- distributed "as is" and without warranties as to performance
- of merchantability or any other warranties whether expressed
- or implied. Because of the various hardware and software
- environments into which this program may be placed, no
- warranty of fitness for a particular purpose is offered.
- Good data processing procedure dictates that any program be
- thoroughly tested with non-critical data before relying on
- it. The user must assume the entire risk of using the
- program. Any liability of the seller will be limited
- exclusively to product replacement or refund of purchase
- price.
-
-
- 3. Here are SOME of the CRUNCHER's Tools
-
- The following is a brief description of the tools used by
- the CRUNCHER. It is by no means exhaustive in its
- description
- but is merely intended to get the reader "up and running". A
- more detailed description of the techniques as well as a
- tutorial is provided to registered users (section 2.1.).
-
- 3.1. Fast Fourier Transform (FFT)
-
- The Fast Fourier Transform (FFT) is a technique used to
- locate regularities in a data set. It is a way of
- representing a very complicated data pattern in terms of its
- linear projection onto sinusoids of various frequency. Thus
- the data can be seen as the sum of many simple periodic
- patterns each with a specific frequency.
-
- A second quantity which can be derived from the FFT is the
- phase angle. Since the original signal can be represented as
- a sum of periodic patterns, it may be important to know the
- temporal relationship among each of the simpler patterns.
- That is, if they are time-shifted with respect to one
- another or not. The PHASE SPECTRUM tells the user the phase
- angle at each frequency. Generally, the user is only
- interested in those frequencies containing relatively large
- amounts of the total power in the spectrum. Therefore,
- one may compare for instance the phase angle for numerous
- data sets at a specific frequency and its higher harmonics.
-
- In general, the FFT is a good method to decompose a data set
- which has multiple frequencies embedded in it.
-
- 3.2. Wavelet Analysis
-
- Wavelet analysis is fairly new to mainstream signal
- processing. It is a projective technique similar to the FFT,
- however, rather than simply decomposing the signal into
- sinusoids of varying frequency, the data is represented as
- projections onto the affine group (translations and
- dilations). This means the data set can be represented as
- time translations of the mother wavelet (a basis function)
- and/or time dilations (i.e. shrinking or expanding the time
- scale of observation). The CRUNCHER uses what is called the
- Mexican Hat as the mother wavelet (the function looks like a
- slice through a sombrero).
-
- Typically, wavelet analysis is an excellent method for
- locating short-lived, high frequency patterns. This is
- because it avoids the time vs. frequency resolution problem
- inherent in Fourier analysis.
-
- 3.3. Autocovariance
-
- The autocovariance function of a signal is a time dependent
- plot of the correlation of the signal with itself at
- different time lags. If the signal is periodic, the
- autocovariance of the signal will also be. Following this, a
- time lag of
- one point is introduced each time a correlation is computed
- until the
- final lag of (n-1) time points.
-
- Another use for the autocovariance is to see where the
- signal loses all correlation with itself (i.e. Markov
- processes). This can be seen as the first zero crossing of
- the autocovariance. Consequently, even a periodic signal
- will have a zero crossing in the autocovariance function.
- By examing the autocovariance function of a signal, one can
- tell when in time the signal is correlated with itself and
- to what degree.
-
- 3.4. Crosscovariance
-
- The crosscovariance is similar to the autocovariance
- function except it describes the correlation between two
- signals shifted in time.
-
- 3.5. Coherence Analysis
-
- Coherence is a frequency dependent measure which quantifies
- the magnitude of shared power between two signals. A high
- coherence
- value indicates the two signals have a high concentration of
- power at
- that specific frequency.
-
- A second quantity of the coherence measure is the relative
- phase angle between the two signals at a given frequency.
- The measure of relative phase between two signals yields
- information about the synchrony of the signals at a specific
- frequency. The two signals may be in perfect synchrony (a
- relative phase of 0 degrees) or be exactly out of phase or
- perfect syncopation (180 degrees). This analysis provides a
- means of quantifying the relative degree of synchrony
- between any two signals at each of the frequencies of
- interest.
-
-
- 3.6. Moments Analysis
-
- This module returns the first four moments of the data set
- (the mean, variance, skew, and kurtosis). This information
- is of use
- when attempting to get a general feel for the data set and
- its characteristics. The information can also of course be
- used as a means to statistically quantify the data set in
- comparison with other data.
-
- 3.7. Wigner-Ville Analysis
-
- The Wigner-Ville method of analysis is a technique which has
- similarities to both the FFT and Wavelet methods. It is a
- projection of a data signal onto a family of sinusoids as
- is the case of the FFT, however, it also depends on time
- translations of the signal. The Wigner-Ville method is
- particularly good at uncovering periodic patterns in data
- sets where the signal is not stationary (i.e. the data may
- have a strong trend). By using the Wigner-Ville analysis,
- the data signal can be decomposed into its frequency
- components which are of varying temporal duration.
-
- 3.8. Digital Filtering
-
- The digital filtering routine in the CRUNCHER is a general
- purpose tool for filtering data sets at prescribed band
- widths. For example, if the user wishes to create a new data
- signal consisting of only the 8.0 to 12.0 Hz frequency
- components, one simply needs to specify the high-pass (8.0),
- the low-pass (12.0), and the sampling rate of the original
- data set. The resulting output can be viewed and sent to a
- file for further analysis. Digital filtering is often the
- best way to "clean up" a signal so that its true structure
- can be viewed more easily. This, for example, is often the
- case when the signal contains a large amount of higher
- frequency noise. The user wishing to get rid of this could
- simply use this module and set the high-pass to 0.0 Hz and
- the low-pass setting to whatever is sufficient to eliminate
- the "noise". However, caution must obviously be taken when
- deciding what does and does not constitute noise in a
- signal.
-
- 3.9 Linear Regression
-
- This routine finds a linear equation from a data set by
- minimizing the squared norm between the data and the fit. It
- returns the coefficients to y = ax + b.
-
- 4.0 Linking the Libraries
-
- Here are the procedures for doing command-line linking for a
- program entitled MYPROG using the small model library. You
- must of course use the correct path when calling these various libraries
- however. If you encounter any problems using these command-line linkers,
- please contact me and I will send you the object files you need so that
- you can add them to an already existing library.
-
- Borland:
-
- tlink /c c0s myprog,myprog,myprog,bortc_s emu maths cs
-
- Microsoft:
-
- link myprog,myprog,,msc7_s
-
-
- 5.0 Quick Reference and Structure of the Routines
- __________________________________________________
-
- C R U N C H E R Version 2.2
-
- --- Quick Reference ---
-
- Copyright 1992,1993 by Gene V. Wallenstein
- All rights reserved.
- __________________________________________________
-
- Below is a brief listing and description of the routines
- supplied in the CRUNCHER v2.2
-
-
- (1) Fast Fourier Transform (FFT)
-
- --- fft.c ---
-
- /* Returns the real and imaginary parts of the signal via a
- Fourier transform. */
-
- float
- fft(float *data,float *real,float *imag,int ipts,float rate)
- {
- /*
- *data -- is a pointer to the incoming file.
- *real -- is a pointer to the real components.
- *imag -- is a pointer to the imaginary components.
- ipts -- the number of points in the incoming file.
- rate -- is the sampling rate of the data.
- */
-
- (2) Coherence Analysis
-
- --- cohere.c ---
-
- /* Cohere (normalized cross spectrum) calculates the
- coherence or "normalized shared power" between two signals.
- The phase is the relative phase between the two signals. */
-
- float
- cohere(float *data1,float *data2,float *out,int ipts,float
- rate,int iflag)
- {
- /*
- *data1 -- pointer to the 1st data file.
- *data2 -- pointer to the 2nd data file.
- *out -- pointer to the results file.
- ipts -- the number of points in each data file.
- rate -- the sampling rate.
- iflag -- 0 for the cross power
- 1 for the relative phase.
- */
-
- (3) Spectral Analysis
-
- --- spectrum.c ---
-
- /* Returns the power spectral density or phase depending on
- IFLAG. */
-
- float
- spectrum(float *data,float *out,int ipts,float rate,int
- iflag,int win)
- {
- /*
- *data -- is a pointer to the incoming file.
- *out -- is a pointer to the results file.
- ipts -- the number of points in the incoming file.
- rate -- is the sampling rate of the data.
- iflag -- 0 for POWER
- 1 for PHASE.
- win -- 0 for no window
- 1 for Hanning window.
- */
-
- (4) Cross Covariance Analysis
-
- --- crosscov.c ---
-
- /* Returns the crosscovariance of two signals. */
-
- float
- crosscov(float *data1,float *data2,float *out,int ipts)
- {
- /*
- *data1 -- pointer to the 1st data file.
- *data2 -- pointer to the 2nd data file.
- *out -- pointer to the results file.
- ipts -- number of points in each data file.
- */
-
- (5) Auto Covariance Analysis
-
- --- autocov.c ---
-
- /* Returns the autocovariance of a signal. */
-
- float
- autocov(float *data,float *out,int ipts)
- {
- /*
- *data -- pointer to the data file.
- *out -- pointer to the results file.
- ipts -- number of points in the data file.
- */
-
- (6) Digital Filter
-
- --- filter.c ---
-
- /* A digital filter routine. The user specifies a center
- band. */
-
- float
- filter(float *data,float *out,int ipts,float rate,float
- freq)
- {
- /*
- *data -- is a pointer to the data file.
- *out -- is a pointer to the results file.
- ipts -- is the number of points in the data file.
- rate -- is the sampling rate of the data file.
- freq -- is the center band of the filter.
- */
-
- (7) Cross Spectral Analysis
-
- --- crossspc.c ---
-
- /* Crossspc (cross spectrum) calculates the cross spectrum
- or "shared power" between two signals. The phase is the
- relative phase between the two signals. */
-
- float
- crossspc(float *data1,float *data2,float *out,int ipts,float
- rate,int iflag)
- {
- /*
- *data1 -- pointer to the 1st data file.
- *data2 -- pointer to the 2nd data file.
- *out -- pointer to the results file.
- ipts -- the number of points in each data file.
- rate -- the sampling rate.
- iflag -- 0 for the cross power
- 1 for the relative phase.
- */
-
- (8) Moments Analysis
-
- --- moments.c ---
-
- /* Moments calculates the first four moments from a user-
- supplied data signal. */
-
- float
- moments(float *data,float *out,int ipts)
- {
- /*
- *data -- is a pointer to the data file.
- *out -- is a pointer to the results file.
- *(out+1) = mean
- *(out+2) = variance
- *(out+3) = skew
- *(out+4) = kurtosis
- ipts -- is the number of points in the data file.
- */
-
- (9) Wavelet Analysis
-
- --- wavelet.c ---
-
- /* Returns the wavelet transform of a data file.
-
- NOTE: DATA length must be an integer power of two (i.e.
- 2^n). */
-
- float
- wavelet(float *data,float *out,int ipts)
- {
- /*
- *data -- is a pointer to the incoming file.
- *out -- pointer to the transform results.
- ipts -- the number of points in the incoming file.
- */
-
- (10) Wigner-Ville Transform
-
- --- wigvil.c ---
-
- /* Wigner-Ville transform as a function of frequency and a
- user supplied delay time, t. */
-
- float
- wigvil(float *data,float *out,float t,int ipts)
- {
- /*
- *data -- pointer to the data file.
- *out -- pointer to the results file.
- t -- delay time.
- ipts -- Number of points in the data file.
- */
-
- (11) Linear Regression and Modeling
-
- --- linear.c ---
-
- /* Linear regression - returns the a and b values from a
- linear least squares fit of the data to an equation of the
- form y = a + bx. */
-
- float
- linear(float *data,float *out,int ipts)
- {
- /*
- *data -- is a pointer to the incoming file.
- ipts -- the number of points in the incoming file.
- *out+1 -- pointer to the a coefficient.
- *out+2 -- pointer to the b coefficient.
- */
-