Keywords: front-page

## Lab: Generation of Sinusoidal Data

[Exercises] [Workspace]

Purpose: Generation of 1D and 2D sinusoidal waves are essential for the creation of test patterns, color maps, filter kernels, etc., and can be used in either the frequency domain. The purpose of this lab is to create 1D and 2D sinusoidal data sets.

Activities:

1. Use the operator Sinusoid to generate 1D sinusoidal data sets. Displaythe data sets using the Display 2D Plot operator.

   1. Use Sinusoid to generate a 1D sinusoidal data set with the following parameters:

                  Amplitude = 1,
                  Length = 50,
                  Number of Cycles = 3 (or Period = 50/3 pixels)
                  Phase = 0.

      Display the data sets using the Display 2D Plot operator. This can be accomplished by selecting the following operator:

      1. Glyphs:Input/Output:Generate Data:Sinusoid
      2. Glyphs:Visualization:Plot Display:Display 2D Plot
      3. Open the Sinusoid pane and set the following parameters:

                     "Width" = 50 (all other dimensions = 1)
                     "Amplitude" = 1.0
                     "Number of sine waves along Width" = 3
                     "Width Phase Offset" = 0.0

      4. Connect Sinusoid to Display 2D Plot and run the workspace.
      5. The plot that initially displayed in the Display 2D Plot window is a line plot. Select the "Options" menu in the plot window and change the "Plot Type" to "Discrete".

   2. Generate and plot a 1D maximum period wave.

      1. Select and duplicate the Sinusoid and Display 2D Plot operators from part 1.
      2. Open the Sinusoid pane and change the "Number of sine waves along Width" to 1
      3. Run the operators, and view the data as a discrete plot

   3. Generate and plot a 1D minimum period wave.

      1. Select and duplicate the Sinusoid and Display 2D Plot operators from part 1.
      2. Open the Sinusoid pane and change the "Number of sine waves along Width" to 25, and the "Width Phase Offset" to 90.
      3. Run the operators, and view the data as a discrete plot

2. Use Sinusoid to generate 2D sinusoidal data sets. Visualize the data sets using the Display Image operator. Use the Extract and Display 2D Plot operators to examine the width and height components of the function separately.

   1. Generate a 2D sinusoidal data set with parameters set such that it creates a diagonal sinusoidal pattern. Visualize the data using the Display Image operator. Extract the first row and column of data, and plot the data with the Display 2D Plot operator.

      1. Glyphs:Input/Output:Generate Data:Sinusoid
      2. Glyphs:Visualization:Non-Interactive Display:Display Image
      3. Glyphs:Data Manip:Size & Region Operators:Extract (2 of these)
      4. Glyphs:Visualization:Plot Display:Display 2D Plot (2 of these)
      5. Open the Sinusoid pane and set the following parameters:

                     Amplitude = 1,
                     Width Parameters:  Width = 200,
                                        Number of Cycles = 10,
                                        Phase Offset = 45 degrees
                     Height Parameters: Height = 100,
                                        Number of Cycles = 5,
                                        Phase Offset = 90 degrees

      6. Connect Sinusoid operator to the Display Image, and run those two operators.
      7. Connect the output of Sinusoid to the inputs of the two Extract operators. Set up one Extract to extract the first width of data, and theother to extract the first height of data.
      8. Connect the Extract operators the Display 2D Plot operators, and run them. View the plots as discrete plots.

   2. Use the existing 2D sinusoid generation network to generate and visualize a maximum period 2D-wave.

      1. Open the Sinusoid pane and change the "Number of sine waves along Width" to 1, and "Number of sine waves along Height" to 0. Set all "Phase Offsets" to 0.
      2. Run the network

   3. Use the existing network to generate and visualize a minimum period 2D-wave.

      1. Open the Sinusoid pane and change the "Number of sine waves along Width" to 100, and "Number of sine waves along Height" to 50. Set the "Width Phase Offset" to 90.
      2. Select Glyphs:Visualization:Non-Interactive Display:Display Zoom Image from the cantata menu and connect the output of Sinusoid to the input of Display Zoom Image
      3. Run the network
      4. When the zoom window comes up, select the "Options" button and change the "Zoom Factor" to 8 to better visualize the pattern created by the minimum period wave.

Exercises

1. Why does the maximum frequency not depend on the data dimensions?
2. What happens if a frequency larger than the maximum (1/2) is specified?
3. Why was a phase parameter of 90 degrees used to generate the maximum frequency signal?

Khoros Workspace
Execute the visual program c2s2sinusoids.wk