<< Chapter < Page
  Digital signal processing - dsp     Page 13 / 25
Chapter >> Page >

To make a long story short, the class named Convolve01 provides a static method named convolve , which applies an incoming convolution operator to an incoming set of data and deposits thefiltered data in an output array whose reference is received as an incoming parameter.

This class could easily be broken out and put in a library as a stand-alone class, or the convolve method could be added to a class containing a variety of DSP methods.

The discrete Fourier transform (dft)

The entire class named Dft01 is shown in Listing 18 .

As with convolution, if you already understand the discrete Fourier transform, you will probably find the code in this class to be straightforward.If not, the code will probably still be straightforward, but the reasons for the code may be obscure. Since the purpose of this module is not to explain digitalsignal processing concepts, I won't attempt to provide a detailed explanation for the code in this method at this time.

Listing 18. The discrete Fourier transform (DFT).
class Dft01{ public static void dft(double[] data,int dataLen, double[]spectrum){ //Set the frequency increment to// the reciprocal of the data // length. This is convenience// only, and is not a requirement // of the DFT algorithm.double delF = 1.0/dataLen; //Outer loop iterates on frequency// values. for(int i=0; i<dataLen;i++){ double freq = i*delF;double real = 0; double imag = 0;//Inner loop iterates on time- // series points.for(int j=0; j<dataLen; j++){ real += data[j]*Math.cos( 2*Math.PI*freq*j);imag += data[j]*Math.sin(2*Math.PI*freq*j); spectrum[i]= Math.sqrt( real*real + imag*imag);}//end inner loop }//end outer loop}//end dft }//end Dft01

Once again, to make a long story short, this class provides a static method named dft , which computes and returns the amplitude spectrum of an incoming time series.

The amplitude spectrum is computed as the square root of the sum of the squares of the real and imaginary parts.

A DFT algorithm can compute any number of points in the frequency domain. In this case, the number of points computed in the frequency domain is equal to thenumber of samples in the incoming time series, which is a fairly common practice.

The method deposits the frequency data in an array whose reference is received as an incoming parameter.

As with convolution, this class could easily be broken out and put in a library as a stand-alone class, or the dft method could be added to a class containing a variety of DSP methods.

Two plotting programs

Now that you have examined the sample data-generator programs, some of you may be interested in an explanation of the plotting program itself.

If you are interested only in how to use the plotting programs, and are not interested in the programming details of the plotting programs, skip ahead tothe section titled Run the Program .

If you are interested in learning how the plotting programs do what they do, keep reading.

Questions & Answers

if three forces F1.f2 .f3 act at a point on a Cartesian plane in the daigram .....so if the question says write down the x and y components ..... I really don't understand
Syamthanda Reply
hey , can you please explain oxidation reaction & redox ?
Boitumelo Reply
hey , can you please explain oxidation reaction and redox ?
Boitumelo
for grade 12 or grade 11?
Sibulele
the value of V1 and V2
Tumelo Reply
advantages of electrons in a circuit
Rethabile Reply
we're do you find electromagnetism past papers
Ntombifuthi
what a normal force
Tholulwazi Reply
it is the force or component of the force that the surface exert on an object incontact with it and which acts perpendicular to the surface
Sihle
what is physics?
Petrus Reply
what is the half reaction of Potassium and chlorine
Anna Reply
how to calculate coefficient of static friction
Lisa Reply
how to calculate static friction
Lisa
How to calculate a current
Tumelo
how to calculate the magnitude of horizontal component of the applied force
Mogano
How to calculate force
Monambi
a structure of a thermocouple used to measure inner temperature
Anna Reply
a fixed gas of a mass is held at standard pressure temperature of 15 degrees Celsius .Calculate the temperature of the gas in Celsius if the pressure is changed to 2×10 to the power 4
Amahle Reply
How is energy being used in bonding?
Raymond Reply
what is acceleration
Syamthanda Reply
a rate of change in velocity of an object whith respect to time
Khuthadzo
how can we find the moment of torque of a circular object
Kidist
Acceleration is a rate of change in velocity.
Justice
t =r×f
Khuthadzo
how to calculate tension by substitution
Precious Reply
hi
Shongi
hi
Leago
use fnet method. how many obects are being calculated ?
Khuthadzo
khuthadzo hii
Hulisani
how to calculate acceleration and tension force
Lungile Reply
you use Fnet equals ma , newtoms second law formula
Masego
please help me with vectors in two dimensions
Mulaudzi Reply
how to calculate normal force
Mulaudzi
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Digital signal processing - dsp. OpenStax CNX. Jan 06, 2016 Download for free at https://legacy.cnx.org/content/col11642/1.38
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Digital signal processing - dsp' conversation and receive update notifications?

Ask