Example 1: Simply PSD


Let's run our first exercise by means of the graphical programming environment called LTPDA Workbench. To start the workbench, issue the following command on the MATLAB terminal, or click on the "LTPDA Workbench" button on the launch bay.

  LTPDAworkbench

Now let's go ahead an create a new pipeline, or analysis diagram. There are many ways to do this: hit ctrl-n (cmd-n on Mac OS X), or select "New Pipeline" from the "Pipeline" menu. (For more details on this and the other commands using the workbench environment please refert to the appropriate section of the user manual.)

Let's use the command "Pipeline -> Rename Pipeline" to give this diagram a more significant name, such for instance "LTPDA Training Session PSD1". You should see a window like the one below:

Empty workbench

The idea of the first exercise is the following:

  1. simulate a time-series of white noise data
  2. evaluate the Power Spectrum of the data
  3. extract the square root of the calculated power spectrum
  4. plot the results
In a flow diagram, the representation is as follows:

Dataflow for the 1st example of ao/psd

Well, let's do it.

Simulate a time-series of white noise data

There are many different ways to simulate a white noise time series data. Here we choose a pretty powerful one. Add an LTPDA Algorithm block to the canvas, selecting the block in the LTPDA library, and either
  • drag the block to the canvas
  • hit return to add the block to the canvas
  • right-click on the library entry and select 'add block'
  • You can also use the "Quick Block" dialog. This is especially useful if you know the name of the block you are looking for. To open the Quick Block dialog, hit ctrl-b (cmd-b on Mac OS X) on the Canvas.



    Quick Block

    To get the ao constructor block we want, just start typing in the "method" edit field. Once the block ao is top of the list, just hit enter to add it to the canvas. You can also double-click on the block list to add any of the blocks in the list.

    Then let's choose, from the "Parameters" drop-down list, the "From Waveform option" set, and hit "Set" to assign this choice to the currently selected ao constructor block.

    We can now tune the parameters of the ao constructor: in particular, let's double click on the first parameter line, within the "Value" colum, so we can choose "noise" from the drop-down list that will appear. If needed, more help can be found here.

    Then let's make the time series last longer by selecting the number of seconds nsecs value to 1000.

    Eventually, we set the units of the noise to be meters by selecting the "unit" parameter and entering 'm'.

    Evaluate the Power Spectrum of the data

    Now let's go ahead and search within the libray for the psd method on the ao class. To do that, just click on the "Library" button on the top left of the screen, and type the word in the "search" box. Once we found the psd method, let's add it to the diagram, and then connect its input to the output of the ao constructor block.

    The next step is choosing the parameters. After selecting the "Default" set and clicking "Set", we can proceed and modify the parameters. Let's discuss about the parameters and their meaning:

    If the user does not specify any value for the parameters, the routine applies the default values. When called within the LTPDAworkbench graphical environment, the default parameters are explicitly shown after selecting the "Default" set and clicking "Set".

    In this case, we will use the default parameters:

    Extract the square root of the calculated power spectrum

    For this exercise, we proceed on extracting the square root of the calculated spectrum. Notice: by default, as described in its help, sqrt applied to to fsdata and tsdata object acts only on the y (dependent) variable. We'll see in the following that is possible to choose different outputs so to avoid this step, if wanted ... So let's add the sqrt method to the diagram and and connect it to the output of the psd method.

    Plot the results

    What's remaining is just plotting the calculated square root of the psd of the inout white noise. Just add the iplot block and connect it ... and why not adding a new iplot to look at the face of the input time-series signal? So at the end we should have a situation like the following: PSD 1 workbench ready for execution

    Notice that we also renamed the individual blocks, by double clicking on them and typing in the informations, and we changed the zoom amount by using the mouse scroll wheel or the commands available under the "View" menu.

    Then we can execute the diagram, by clicking on the "Run" button on the bottom center, and the calculation should end up with 2 figures. The second one should be the following: PSD 1: evaluated PSD

    Please notice:




    ©LTP Team