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

A 3D parabolic surface

The array of surface elevation data is populated by the code in Listing 2 .

Listing 2. A 3D parabolic surface,
for(int row = 0;row<numberRows;row++){ for(int col = 0;col<numberCols;col++){ int xSquare = col * col;int ySquare = row * row; data[row][col] = xSquare + ySquare;}//end col loop }//end row loop

I will allow you to evaluate this code on your own. It creates a 3D surface with the lowest elevation at the upper left corner and the highest elevation atthe lower right corner. The surface is a one-quarter section of a 3D parabola, as shown in Figure 3 .

Display six surface images

Listing 3 shows the code that causes the 3D surface elevation data to be displayed as six independent images (each statement in Listing 3 produces one output image) .

IMPORTANT: this is the same code that would be used by other programs to incorporate this 3D surface plottingcapability into those programs.
Listing 3. Display six surface images.
new ImgMod29(data,blockSize,true,0); new ImgMod29(data,blockSize,false,1);new ImgMod29(data,blockSize,true,2); new ImgMod29(data,blockSize,true,3);new ImgMod29(data,blockSize,false,4); new ImgMod29(data,blockSize,true,5);

Just instantiate an object

All that is necessary for another program to incorporate this class to display a 3D surface is to instantiate an object of the class named ImgMod29 passing four parameters to the constructor.

The parameters

The first parameter is a reference to the 2D array of type double containing the surface elevation values.

The second parameter is the blockSize . This int value specifies the size of one side of a square of pixels, (all of the same color) that will be used to represent each surface elevation value in the final display. As mentioned earlier, this value was set to 2 in the sampledisplays produced by the main method. However, it could have been any reasonable value such as 5, 10, or 15 for example.

The third parameter is true if you want the red axes to be drawn and is false otherwise (as shown in Figure 3 ) .

The fourth parameter is an integer value between 0 and 5 inclusive, which specifies the plotting format as follows:

  • 0 - Grayscale (linear)
  • 1 - Color Shift (linear)
  • 2 - Color Contour (linear)
  • 3 - Grayscale with logarithmic data conversion before plotting
  • 4 - Color Shift with logarithmic data conversion before plotting
  • 5 - Color Contour with logarithmic data conversion before plotting

Instantiate six separate objects

Listing 3 instantiates six such objects to display the same 3D surface, one for each plotting format as shown in Figure 3 . Some of the objects display the axes and others do not. All use a blockSize value of 2.

Each display object appears in the upper-left corner of the screen. Thus, when two or more such objects are instantiated, they appear as a stack. It isnecessary to physically move those on top of the stack to see those further down.

Listing 3 signals the end of the main method.

The ImgMod29 class

Listing 4 shows the beginning of the class named ImgMod29 and the beginning of the constructor for the class.

Questions & Answers

how do you get the 2/50
Abba Reply
number of sport play by 50 student construct discrete data
Aminu Reply
width of the frangebany leaves on how to write a introduction
Theresa Reply
Solve the mean of variance
Veronica Reply
Step 1: Find the mean. To find the mean, add up all the scores, then divide them by the number of scores. ... Step 2: Find each score's deviation from the mean. ... Step 3: Square each deviation from the mean. ... Step 4: Find the sum of squares. ... Step 5: Divide the sum of squares by n – 1 or N.
kenneth
what is error
Yakuba Reply
Is mistake done to something
Vutshila
Hy
anas
hy
What is the life teble
anas
hy
Jibrin
statistics is the analyzing of data
Tajudeen Reply
what is statics?
Zelalem Reply
how do you calculate mean
Gloria Reply
diveving the sum if all values
Shaynaynay
let A1,A2 and A3 events be independent,show that (A1)^c, (A2)^c and (A3)^c are independent?
Fisaye Reply
what is statistics
Akhisani Reply
data collected all over the world
Shaynaynay
construct a less than and more than table
Imad Reply
The sample of 16 students is taken. The average age in the sample was 22 years with astandard deviation of 6 years. Construct a 95% confidence interval for the age of the population.
Aschalew Reply
Bhartdarshan' is an internet-based travel agency wherein customer can see videos of the cities they plant to visit. The number of hits daily is a normally distributed random variable with a mean of 10,000 and a standard deviation of 2,400 a. what is the probability of getting more than 12,000 hits? b. what is the probability of getting fewer than 9,000 hits?
Akshay Reply
Bhartdarshan'is an internet-based travel agency wherein customer can see videos of the cities they plan to visit. The number of hits daily is a normally distributed random variable with a mean of 10,000 and a standard deviation of 2,400. a. What is the probability of getting more than 12,000 hits
Akshay
1
Bright
Sorry i want to learn more about this question
Bright
Someone help
Bright
a= 0.20233 b=0.3384
Sufiyan
a
Shaynaynay
How do I interpret level of significance?
Mohd Reply
It depends on your business problem or in Machine Learning you could use ROC- AUC cruve to decide the threshold value
Shivam
how skewness and kurtosis are used in statistics
Owen Reply
yes what is it
Taneeya
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