Writing LTPDA scripts

Up to now, all the activity of the tutorial has been carried out on the MATLAB command terminal. It is, of course, much more convenient to collect the commands together in to a MATLAB script. In this sense, LTPDA scripting is just the same as normal MATLAB scripting; just using LTPDA commands.

Here's an example script which makes two white-noise time-series and estimates the power-spectral-density of each.

%% Make two test AOs

a1 = ao(plist('tsfcn', 'randn(size(t))', 'fs', 10, 'nsecs', 100));
a2 = ao(plist('tsfcn', 'randn(size(t))', 'fs', 10, 'nsecs', 100));

%% Make PSD Estimates

psds = psd(a1, a2);
a1xx = psds(1);
a2xx = psds(2);

% The following also works.
b1xx = psd(a1); 
b2xx = psd(a2); 

You can explore the commands used to rebuild the object by using the type method. Or you can inspect (with type or viewHistory the history as we did earlier. For example, try this command for each of the cases above:


©LTP Team