<< Chapter < Page
  Digital signal processing - dsp     Page 14 / 24
Chapter >> Page >

Perform the spectral analysis

The code in Listing 12 creates array objects to receive the results and calls the static transform method of the forwardRealToComplex01 class five times in succession to perform the spectral analysis on each of the five sinusoids.

(I will explain the transform method that performs the spectral analysis shortly.)

Only the magnitude data is displayed by this program. Therefore, the arrays that receive the other spectral analysis results from the transform method arediscarded each time a new spectral analysis is performed.

Listing 12. Perform the spectral analysis.
magnitude1 = new double[len];real = new double[len];imag = new double[len];angle = new double[len];ForwardRealToComplex01.transform(data1,real, imag,angle,magnitude1,zeroTime,lowF,highF);magnitude2 = new double[len];real = new double[len];imag = new double[len];angle = new double[len];ForwardRealToComplex01.transform(data2,real, imag,angle,magnitude2,zeroTime,lowF,highF);magnitude3 = new double[len];real = new double[len];imag = new double[len];angle = new double[len];ForwardRealToComplex01.transform(data3,real, imag,angle,magnitude3,zeroTime,lowF,highF);magnitude4 = new double[len];real = new double[len];imag = new double[len];angle = new double[len];ForwardRealToComplex01.transform(data4,real, imag,angle,magnitude4,zeroTime,lowF,highF);magnitude5 = new double[len];real = new double[len];imag = new double[len];angle = new double[len];ForwardRealToComplex01.transform(data5,real, imag,angle,magnitude5,zeroTime,lowF,highF);}//end constructor

The spectral magnitude results

Note that the magnitude results are saved in the array objects referred to by magnitude1 , magnitude2 , etc. This will be important later when I discuss the interface methods defined by Dsp028 .

The end of the constructor

Listing 12 also signals the end of the constructor. When the constructor terminates, the object has been instantiated and populated with spectralanalysis results for five sinusoids using the parameters specified by the file named Dsp028.tx t.

The getparameters method

The getParameters method used in this program is the same as that used in Dsp029 , so I won't discuss it further.

The interface methods

The Dsp028 class must define the same six interface methods as the Dsp029 class, which I discussed earlier. The only difference in the interface methods is the identification of the array objectsfrom which the methods return data when the methods are called.

The code in Listing 13 is typical of the code for methods f1 through f5 . As you can see, these methods return the data stored in the magnitude arrays. These are the spectral analysis results that areplotted in Figure 9 , Figure 11 , and later in Figure 14 .

Listing 13. The method named f1.
public double f1(double x){ int index = (int)Math.round(x);if(index<0 || index>magnitude1.length-1){ return 0;}else{ return magnitude1[index]; }//end else}//end function

The program named Graph03

The plots in Figure 9 and Figure 11 were produced by entering the following at the command line prompt:

Questions & Answers

I'm interested in biological psychology and cognitive psychology
Tanya Reply
what does preconceived mean
sammie Reply
physiological Psychology
Nwosu Reply
How can I develope my cognitive domain
Amanyire Reply
why is communication effective
Dakolo Reply
Communication is effective because it allows individuals to share ideas, thoughts, and information with others.
effective communication can lead to improved outcomes in various settings, including personal relationships, business environments, and educational settings. By communicating effectively, individuals can negotiate effectively, solve problems collaboratively, and work towards common goals.
it starts up serve and return practice/assessments.it helps find voice talking therapy also assessments through relaxed conversation.
miss
Every time someone flushes a toilet in the apartment building, the person begins to jumb back automatically after hearing the flush, before the water temperature changes. Identify the types of learning, if it is classical conditioning identify the NS, UCS, CS and CR. If it is operant conditioning, identify the type of consequence positive reinforcement, negative reinforcement or punishment
Wekolamo Reply
please i need answer
Wekolamo
because it helps many people around the world to understand how to interact with other people and understand them well, for example at work (job).
Manix Reply
Agreed 👍 There are many parts of our brains and behaviors, we really need to get to know. Blessings for everyone and happy Sunday!
ARC
A child is a member of community not society elucidate ?
JESSY Reply
Isn't practices worldwide, be it psychology, be it science. isn't much just a false belief of control over something the mind cannot truly comprehend?
Simon Reply
compare and contrast skinner's perspective on personality development on freud
namakula Reply
Skinner skipped the whole unconscious phenomenon and rather emphasized on classical conditioning
war
explain how nature and nurture affect the development and later the productivity of an individual.
Amesalu Reply
nature is an hereditary factor while nurture is an environmental factor which constitute an individual personality. so if an individual's parent has a deviant behavior and was also brought up in an deviant environment, observation of the behavior and the inborn trait we make the individual deviant.
Samuel
I am taking this course because I am hoping that I could somehow learn more about my chosen field of interest and due to the fact that being a PsyD really ignites my passion as an individual the more I hope to learn about developing and literally explore the complexity of my critical thinking skills
Zyryn Reply
good👍
Jonathan
and having a good philosophy of the world is like a sandwich and a peanut butter 👍
Jonathan
generally amnesi how long yrs memory loss
Kelu Reply
interpersonal relationships
Abdulfatai Reply
What would be the best educational aid(s) for gifted kids/savants?
Heidi Reply
treat them normal, if they want help then give them. that will make everyone happy
Saurabh
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