<< Chapter < Page
  Digital signal processing - dsp     Page 23 / 27
Chapter >> Page >

Some data is not random

Fifteen of the data values for each data set are not random for the same reasons discussed earlier. Figure 3 shows how these specific values confirm proper transition from one trace to the next on the same page and confirm theproper transition from one page to the next.

Modified constructor code

The first code that I will highlight as being different from the code in the class named PlotALot02 is shown in Listing 33 . This code appears in the modified constructor for the PlotALot03 class.

Listing 33. Modified constructor code.
if((tracesPerPage == 0) || (tracesPerPage%2 != 0) ){System.out.println("Terminating program"); System.exit(0);}//end if samplesPerPage = canvasWidth * tracesPerPage/(sampSpacing + 1)/2;

The if statement in Listing 33 confirms that the number of traces per page is evenly divisible by two. If not, the program terminates.

The last statement in Listing 33 computes the value of samplesPerPage taking into account that only half as many samples from each data set can beplotted on a page as is the case when the plots of the two data sets are superimposed on the same axes in the class named PlotALot02 .

The overridden paint method

Additional code that I will highlight as being different is in the overridden paint method of the MyCanvas class. This code is shown in Listing 34 .

Listing 34. The overridden paint method.
public void paint(Graphics g){ //Draw horizontal axes//...code deleted for brevity//Plot the points if(sampleCounter>0){ for(int cnt = 0;cnt<= sampleCounter; cnt++){//Plot values from the blackData// array object. g.setColor(Color.BLACK);//Compute a vertical offset to locate// the black data on the odd numbered // axes on the page.int yOffset = ((1 + cnt*(sampSpacing + 1)/this.getWidth())*2*traceSpacing) - traceSpacing;//Draw an oval //...code deleted for brevity//Connect the sample values with // straight lines.//...code deleted for brevity//Plot the data stored in the // redData array object.g.setColor(Color.RED); //Compute a vertical offset to locate// the red data on the even numbered // axes on the page.yOffset = (1 + cnt*(sampSpacing + 1)/ this.getWidth())*2*traceSpacing;//Draw the ovals//...code deleted for brevity //Connect the sample values with// straight lines //...code deleted for brevity}//end for loop }//end if for sampleCounter>0 }//end overridden paint method}//end inner class MyCanvas }//end inner class Page}//end class PlotALot02

Some code was deleted for brevity

Most of the code in the overridden paint method is the same as the code that I discussed earlier and was deleted from Listing 34 for brevity.

The code that is different is the code that computes the vertical offset values to locate the black data on the odd numbered axes and to locate the reddata on the even numbered axes as shown in Figure 3 . I will let you work through the expressions in Listing 34 on your own and convince yourself that the code is correct.

Questions & Answers

summarize halerambos & holbon
David Reply
the Three stages of Auguste Comte
Clementina Reply
what are agents of socialization
Antonio Reply
sociology of education
Nuhu Reply
definition of sociology of education
Nuhu
what is culture
Abdulrahim Reply
shared beliefs, values, and practices
AI-Robot
What are the two type of scientific method
ogunniran Reply
I'm willing to join you
Aceng Reply
what are the scientific method of sociology
Man
what is socialization
ogunniran Reply
the process wherein people come to understand societal norms and expectations, to accept society's beliefs, and to be aware of societal values
AI-Robot
scientific method in doing research
ogunniran
defimition of sickness in afica
Anita
Cosmology
ogunniran
Hmmm
ogunniran
list and explain the terms that found in society
REMMY Reply
list and explain the terms that found in society
Mukhtar
what are the agents of socialization
Antonio
Family Peer group Institution
Abdulwajud
I mean the definition
Antonio
ways of perceived deviance indifferent society
Naomi Reply
reasons of joining groups
SAM
to bring development to the nation at large
Hyellafiya
entails of consultative and consensus building from others
Gadama
World first Sociologist?
Abu
What is evolutionary model
Muhammad Reply
Evolution models refer to mathematical and computational representations of the processes involved in biological evolution. These models aim to simulate and understand how species change over time through mechanisms such as natural selection, genetic drift, and mutation. Evolutionary models can be u
faruk
what are the modern trends in religious behaviours
Selekeye Reply
what are social norms
Daniel Reply
shared standards of acceptable behavior by the group or appropriate behavior in a particular institution or those behaviors that are acceptable in a society
Lucius
that is how i understood it
Lucius
examples of societal norms
Diamond
Discuss the characteristics of the research located within positivist and the interpretivist paradigm
Tariro Reply
what is Industrialisation
Selekeye Reply
industrialization
Angelo
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