Introducing objects in LTPDA

LTPDA uses an object-oriented approach for data analysis. That means that the user deals with objects. So what are objects? Objects are instances of a particular class. And what's a class? Well, a class just describes an object. For example, you may have a class 'Car' which has certain properties that describe the features of a car. Once you build a Car according to the class description, then you have an instance of a Car - you have an object. We mentioned properties here. Part of the description of a real-world object (or idea) are the features of that object. These features are captured as properties of the class. For example, our 'Car' class may have a property 'color'. Once we build (instantiate) a 'Car' object, then the property 'color' will have a particular value.

Once you have an object, what can you do with it? Well, classes don't only have properties, they also have methods. These are actions you can perform on or with the object. For example, if we return to our Car analogy, the class 'Car' may have a method called 'start' which, when applied to an instance of the 'Car' class (an object), will start the car.

To bring this more in to the field of data analysis, let's look at another example. Suppose we have a class which defines a digital filter. Let's call this class 'miir' - a MATLAB Infinite Impulse Response filter. Such a class would need to have properties which capture features of a digital filter, for example, numerator and denominator coefficients (or 'a' and 'b' coefficients). We might have methods in the class such as 'resp' to calculate the response of the filter.

One special set of methods that a class typically has are the constructor methods. These don't act on objects, but rather act on the class itself. And, as the name suggests, they are the methods which actually build the objects. They always have the class name and typically, they take a set of input parameters which describe how to build the object we want. Returning to our digital filter example, in LTPDA we have such a class 'miir'. To build an miir object (or make an instance of the class 'miir') you can do:

      filt = miir()

This will create an 'empty' miir object. On the terminal you should see:
  ------ miir/1 -------
          b: []
     histin: []
      ntaps: 0
         fs: []
          a: []
    histout: []
     iunits: []
     ounits: []
       hist: miir.hist 
   procinfo: []
   plotinfo: []
       UUID: 70b4b3cd-2e65-4332-94cc-cffea1b0028c

You can see that the class 'miir' has a number of properties, including 'name', 'description', 'a', 'b', 'iunits', and 'ounits'. To build a more interesting filter you can do something like:
      filt = miir(plist('type', 'lowpass', ...
          'order', 1, ...
          'fs', 10, ...
          'fc', 1))

If you run that command, you will see the following on the terminal:
  ------ miir/1 -------
          b: [1 -0.50952544949442879]
     histin: 0
      ntaps: 2
         fs: 10
          a: [0.2452372752527856 0.2452372752527856]
    histout: 0
     iunits: []
     ounits: []
       hist: miir.hist 
   procinfo: []
   plotinfo: []
       name: lowpass
       UUID: 6729d0ab-b29c-4c4c-9f90-0aca13b496fc

Now you're asking yourself "How do I know which parameters I pass to the constructors?" To find out, read the following section.

Getting Help

There are various places where you can get help with using LTPDA. The most obvious is the User Manual. To access the LTPDA user manual, click on the menu "Help->Product Help" to launch MATLAB's documentation browser (or type 'doc' on the terminal). From there you can browse to the LTPDA Toolbox section.

Help for methods

To get help on individual methods, you use the built-in documentation. For our miir class, you do:

    help miir

which will display some description of the class constructor. The important part is the "Parameters Description" link.
  Parameters Description

Clicking on the link will open a window which describes the possible sets of parameters that you can pass to the constructor. In fact, these "Parameters Description" links are available for all methods in LTPDA, not just class constructors. The figure below shows an example for our miir case.

The following table summarises the terms used in this section.

Term Description
ClassA description of a real-word object or idea
PropertyClasses have properties which encapsulate features of the real-world object.
ObjectAn example of a realisation (or instantiation) of a class.
MethodA function that acts on instances of a class (objects).

©LTP Team