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.
There are, however, one or two caveats to that, especially when it comes to preserving the history. Most notably, indexing and concatenating objects is not captured by the history if you use standard MATLAB notation.
For example, suppose you have two AOs which you want to make a Transfer function between them. The following script shows three different ways to do this, but only two will properly track the history.
%% 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 TFE t11 = tfe(a1, a1); t12 = tfe(a1, a2); t21 = tfe(a2, a1); t22 = tfe(a2, a2); Axx = t12 ./ t21;
You can explore the commands used to rebuild the object by using the type method. Or you can plot the history as we did earlier. For example, try this command for each of the three cases above:
type(Axx)