<< Chapter < Page | Chapter >> Page > |
The program named Dsp034 , when run in conjunction with either Graph03 or Graph06 computes and plots the amplitude, real, imaginary, and phase angle spectrum for a pulsethat is read from a file named Dsp034.txt . If that file doesn't exist in the current directory, the program uses a set of defaultparameters that describe a damped sinusoidal pulse. The program also plots the pulse itself in addition to the spectral analysis results listed above.
When the data is plotted (see Figure 2 ) using the programs Graph03 or Graph06 , the order of the plots from top to bottom in the display is:
Each parameter value must be stored as characters on a separate line in the file named Dsp034.txt . The required parameters and their order and type are as follows:
The number of sample values for the pulse must match the value for the pulselength.
All frequency values are specified as a double representing a fractional part of the sampling frequency. For example, a value of 0.5specifies a frequency that is half the sampling frequency.
Figure 1 provides a set of sample parameter values that can be used to test the program. This sample data describes a triangular pulse. Be careful when youcreate the file containing these values. Don't allow blank lines at the end of the data in the file.
Figure 1. Sample parameters for testing. |
---|
400
110
0.00.5
00
045
90135
9045
00
0 |
The plotting program that is used to plot the output data from this program requires that the program implement GraphIntfc01 .
(I explained the plotting programs and this interface in earlier modules.)
For example, the plotting program named Graph03 can be used to plot the data produced by this program. When it is used, the following shouldbe entered at the command-line prompt:
java Graph03 Dsp034
A static method named transform belonging to the class named ForwardRealToComplex01 is used to perform the actual spectral analysis.
(I explained this class and the transform method in the earlier module titled Spectrum Analysis using Java, Sampling Frequency, Folding Frequency, and the FFT Algorithm . However, I skipped over that portion of the method that computes the phase angle. I will explain that portion of the transform method in this module.)
Notification Switch
Would you like to follow the 'Digital signal processing - dsp' conversation and receive update notifications?