The easiest way to explain some of the functions of J-DSP is to work
through a simple example.
Start the J-DSP editor. It may take 30 seconds to download the program
and a few more seconds to establish the first block but once the first
block is established, the program should run quickly. Adjust the
size of the J-DSP editor window so that you are still able to read this
text or make a printout of this page. Press the "Sig Gen" button
on the left part of the window. Move the mouse to the center of the
window and push the left mouse button. You have created a signal
generator box. Similarly, create a Filter and Plot box and note that
boxes can not be placed on top of one another. Your editor window
should now look like the following:
To select a box, click on it and it will become highlighted. Once a
box is highlighted, you can move it by placing the mouse arrow over it,
holding down the left mouse button and while holding the button down, dragging
the box to a new location. To delete a box, select it and press the del
key on your keyboard.
Next, click inside the small triangle on the right side of the signal
generator box and while holding the mouse button down, slide the mouse
arrow to the triangle on the left side of the filter box. Release the mouse
button to create a connection between the two boxes. Always make the connections
in the direction of the signal flow. Outgoing signals, leave boxes on the
right, incoming signals enter boxes from the left.
Box
|
Inputs
|
Outputs
|
Input (e.g. Sig Gen)
|
0
|
1
|
Output (e.g. Snd Player )
|
1
|
0
|
Filter
|
1
|
1
|
Adder
|
2
|
1
|
Multiply
|
2
|
1
|
Number of inputs and outputs of the different
boxes
Now, connect the Filter box to the Plot box so that your editor window
looks like the following.
Next, we choose our input signal. Double click inside the "Sig Gen"
box and a dialog window appears. If you do not see a dialog window, you
are using an older internet browser and must download the newest version
of Netscape Navigator and start over. On the right side of the signal generator window, you see a preview
of the signal as below. You may change the name of the signal, the gain, the pulsewidth,
the period and the time shift by typing the desired value into the appropriate
box. The signal type can be changed by clicking on the pop down menu and
selecting a signal. If you select a self-defined signal, an edit signal
button will appear allowing you to edit the signal.
Note that for the Sinusoid type of signal, we need to specify
frequency. As sinusoidal signal is inherently periodic, Periodic box is disable.
However, for this particular example of sinusoid with 0.2pi
frequency, the period can be calculated in the following way.
Now push "Close" and the dialog window closes. Next, we want to take a look at the output. Double-click
on the
Output box and a new dialog window will appear. You should again see the
input signal because the filter is just letting the signal pass through
unaffected. If you push ``Graph/Values/Stats.'' button, a table with the values of the signal
pops up. In the first column you see the indices of the samples and the
second column shows you the values. Close the value dialog box. To view the signal in the frequency domain, insert an FFT
box between
the Filter and the Plot box as shown below. The FFT box can be found in the left
panel of
J-DSP editor and also in Freq. Blocks menu located in the list of Existing
functions at the top of J-DSP editor.
Double click on the FFT block and change the size to 256 points and
then push "Close". Now, you see the magnitude and the phase of the signal
in the frequency domain. The magnitude has a sharp peak at 0.6283 (i.e., 0.2pi), the
frequency of our sinusoidal signal.
Close the output dialog box and click inside the filter box. The following form
of transfer function is used in our digital filter.
We will
change some of the filter parameters. The shown numbers are parameters
of the transfer function of the filter. Make the following changes: b0
= 2 and a1= -0.5 and check the output of the system.
Now, delete the filter and coefficient blocks. Create now a second
Sig. Gen box and an Adder box as above. Change the name of the second Sig.
Gen box to ``Noise'' and the name of
the output box to ``Sig+No'' as shown in the Figure. The names are restricted
to six characters. Following, we edit the new input box. Open the dialog
window and change the signal type to random. Choose a variance of 4 and
extend the pulsewidth to 100 samples, in order to have noise over the full
length of the signal. Now take a look at the output signal. In the time
domain it is very hard to see that a sinusoid is present. However, if you
view the signal in the frequency domain with an FFT of size of 256, then
you still find a peak at 0.6283. Please note that the squared magnitude
is shown.
This concludes the introduction to the J-DSP editor.
|