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

Plot the data

The statement in Listing 3 calls the overloaded plotData method to cause all of the pages belonging to the plotting object titled "A" to be stacked in alocation where the upper left corner of the stack is 401 pixels to the right of the upper left corner of the screen.

Listing 3. Plot the data.
plotObjectA.plotData(401,0);

As described earlier, page 0 containing the earliest data fed to the plotting object is on the top of the stack. Figure 1 shows the two pages belonging to this plotting object after they have been manually rearranged to make them bothvisible.

Feed and plot the object titled "B"

Listing 4 feeds 2600 random white noise values to the object titled "B" and displays the pages in the default location in the upper left corner of thescreen. Listing 4 also signals the end of the main method.

Listing 4. Feed and plot the object titled "B".
for(int cnt = 0;cnt<2600;cnt++){ plotObjectB.feedData((Math.random() - 0.5)*25); }//end for loopplotObjectB.plotData();}//end main

Listing 4 (plus one of the statements in Listing 1 ) is much more typical of the amount of code required to use this plotting class than was thecase with Listing 2 .

(Almost all of the code in Listing 2 was required to set the special data values used to test the transitions discussed earlier.)

The three steps

To recap, the three steps required to use this class for plotting nearly unlimited amounts of data are:

  1. Instantiate a plotting object of the class named PlotALot01 , as in Listing 1 .
  2. Call the feedData method once for each data value that is to be plotted, as in Listing 4 .
  3. Call the plotData method on the plotting object afterall of the data has been fed to the plotting object, as in Listing 3 or Listing 4 .

Some instance variables

Continuing with the class definition for the class named PlotALot01 , Listing 5 shows several instance variables that belong to a plotting object instantiatedfrom this class.

Listing 5. Some instance variables.
String title; int frameWidth;int frameHeight; int traceSpacing;//pixels between tracesint sampSpacing;//pixels between samples int ovalWidth;//width of sample marking ovalint ovalHeight;//height of sample marking ovalint tracesPerPage; int samplesPerPage;int pageCounter = 0; int sampleCounter = 0;ArrayList<Page>pageLinks = new ArrayList<Page>();

The purpose of each of these instance variables is indicated by the name of the variable, and in some cases by the comments following the variabledeclaration. In addition, I will have more to say about some of these variables later when I discuss the code that uses them.

(Note the use of generics in the declaration and initialization of the variable named pageLinks . The use of generics dictates that this class requires J2SE 5.0 or later.)

The first overloaded constructor

As mentioned earlier, there are two overloaded versions of the constructor for this class. The overloaded version that begins in Listing 6 accepts several incoming parameters allowing the user to control various aspects of the plottingformat.

Questions & Answers

how does Neisseria cause meningitis
Nyibol Reply
what is microbiologist
Muhammad Reply
what is errata
Muhammad
is the branch of biology that deals with the study of microorganisms.
Ntefuni Reply
What is microbiology
Mercy Reply
studies of microbes
Louisiaste
when we takee the specimen which lumbar,spin,
Ziyad Reply
How bacteria create energy to survive?
Muhamad Reply
Bacteria doesn't produce energy they are dependent upon their substrate in case of lack of nutrients they are able to make spores which helps them to sustain in harsh environments
_Adnan
But not all bacteria make spores, l mean Eukaryotic cells have Mitochondria which acts as powerhouse for them, since bacteria don't have it, what is the substitution for it?
Muhamad
they make spores
Louisiaste
what is sporadic nd endemic, epidemic
Aminu Reply
the significance of food webs for disease transmission
Abreham
food webs brings about an infection as an individual depends on number of diseased foods or carriers dully.
Mark
explain assimilatory nitrate reduction
Esinniobiwa Reply
Assimilatory nitrate reduction is a process that occurs in some microorganisms, such as bacteria and archaea, in which nitrate (NO3-) is reduced to nitrite (NO2-), and then further reduced to ammonia (NH3).
Elkana
This process is called assimilatory nitrate reduction because the nitrogen that is produced is incorporated in the cells of microorganisms where it can be used in the synthesis of amino acids and other nitrogen products
Elkana
Examples of thermophilic organisms
Shu Reply
Give Examples of thermophilic organisms
Shu
advantages of normal Flora to the host
Micheal Reply
Prevent foreign microbes to the host
Abubakar
they provide healthier benefits to their hosts
ayesha
They are friends to host only when Host immune system is strong and become enemies when the host immune system is weakened . very bad relationship!
Mark
what is cell
faisal Reply
cell is the smallest unit of life
Fauziya
cell is the smallest unit of life
Akanni
ok
Innocent
cell is the structural and functional unit of life
Hasan
is the fundamental units of Life
Musa
what are emergency diseases
Micheal Reply
There are nothing like emergency disease but there are some common medical emergency which can occur simultaneously like Bleeding,heart attack,Breathing difficulties,severe pain heart stock.Hope you will get my point .Have a nice day ❣️
_Adnan
define infection ,prevention and control
Innocent
I think infection prevention and control is the avoidance of all things we do that gives out break of infections and promotion of health practices that promote life
Lubega
Heyy Lubega hussein where are u from?
_Adnan
en français
Adama
which site have a normal flora
ESTHER Reply
Many sites of the body have it Skin Nasal cavity Oral cavity Gastro intestinal tract
Safaa
skin
Asiina
skin,Oral,Nasal,GIt
Sadik
How can Commensal can Bacteria change into pathogen?
Sadik
How can Commensal Bacteria change into pathogen?
Sadik
all
Tesfaye
by fussion
Asiina
what are the advantages of normal Flora to the host
Micheal
what are the ways of control and prevention of nosocomial infection in the hospital
Micheal
what is inflammation
Shelly Reply
part of a tissue or an organ being wounded or bruised.
Wilfred
what term is used to name and classify microorganisms?
Micheal Reply
Binomial nomenclature
adeolu
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