<< 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

Ayele, K., 2003. Introductory Economics, 3rd ed., Addis Ababa.
Widad Reply
can you send the book attached ?
Ariel
?
Ariel
What is economics
Widad Reply
the study of how humans make choices under conditions of scarcity
AI-Robot
U(x,y) = (x×y)1/2 find mu of x for y
Desalegn Reply
U(x,y) = (x×y)1/2 find mu of x for y
Desalegn
what is ecnomics
Jan Reply
this is the study of how the society manages it's scarce resources
Belonwu
what is macroeconomic
John Reply
macroeconomic is the branch of economics which studies actions, scale, activities and behaviour of the aggregate economy as a whole.
husaini
etc
husaini
difference between firm and industry
husaini Reply
what's the difference between a firm and an industry
Abdul
firm is the unit which transform inputs to output where as industry contain combination of firms with similar production 😅😅
Abdulraufu
Suppose the demand function that a firm faces shifted from Qd  120 3P to Qd  90  3P and the supply function has shifted from QS  20  2P to QS 10  2P . a) Find the effect of this change on price and quantity. b) Which of the changes in demand and supply is higher?
Toofiq Reply
explain standard reason why economic is a science
innocent Reply
factors influencing supply
Petrus Reply
what is economic.
Milan Reply
scares means__________________ends resources. unlimited
Jan
economics is a science that studies human behaviour as a relationship b/w ends and scares means which have alternative uses
Jan
calculate the profit maximizing for demand and supply
Zarshad Reply
Why qualify 28 supplies
Milan
what are explicit costs
Nomsa Reply
out-of-pocket costs for a firm, for example, payments for wages and salaries, rent, or materials
AI-Robot
concepts of supply in microeconomics
David Reply
economic overview notes
Amahle Reply
identify a demand and a supply curve
Salome Reply
i don't know
Parul
there's a difference
Aryan
Demand curve shows that how supply and others conditions affect on demand of a particular thing and what percent demand increase whith increase of supply of goods
Israr
Hi Sir please how do u calculate Cross elastic demand and income elastic demand?
Abari
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