Constructor examples of the PARFRAC class


Copy an parfrac object
Construct an parfrac object by loading the object from a file
Construct an parfrac object from a rational object
Construct an parfrac object from a pole/zero model
Construct an parfrac object from residuals, poles and direct terms
Construct an parfrac object from a parameter list object (PLIST)

Copy an parfrac object

The following example creates a copy of an parfrac object (blue command).

>> pf1 = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], 3)
>> pf2 = parfrac(pf1)
---- parfrac 1 ----
model:    None
res:      [1;2+i*1;2-i*1]
poles:    [6;1+i*3;1-i*3]
dir:      3
pmul:     [1;1;1]
iunits:   []
ounits:   []
-------------------


REMARK: The following command copies only the handle of an object and doesn't create a copy of the object (as above). This means that everything that happens to the copy or original happens to the other object.

>> pf1 = parfrac()
---- parfrac 1 ----
model:    none
res:      []
poles:    []
dir:      0
pmul:     []
iunits:   []
ounits:   []
-------------------
>> pf2 = pf1;
>> pf2.setName('my new name')
---- parfrac 1 ----
model:    my new name
res:      []
poles:    []
dir:      0
pmul:     []
iunits:   []
ounits:   []
-------------------


If we display pf1 again then we see that the property 'name' was changed although we only have changed pf2.

>> pf1
---- parfrac 1 ----
model:    my new name
res:      []
poles:    []
dir:      0
pmul:     []
iunits:   []
ounits:   []
-------------------

Construct an parfrac object by loading the object from a file

The following example creates a new parfrac object by loading the object from disk.

pf = parfrac('parfrac_object.mat')
pf = parfrac('parfrac_object.xml')

or in a PLIST

pl = plist('filename', 'parfrac_object.xml');
pf = parfrac(pl)

Construct an parfrac object from a rational object

The following example creates a new parfrac object from a rational object.

>> rat = rational([1 2 3], [4 5 6 7], 'my rational')
---- rational 1 ----
model:    my rational
num:      [1 2 3]
den:      [4 5 6 7]
iunits:   []
ounits:   []
--------------------
>> pf = parfrac(rat)
---- parfrac 1 ----
model:    parfrac(my rational)
res:      [0.0355+i*0.1682; 0.0355-i*0.1682; 0.1788]
poles:    [-0.021-i*1.2035;-0.0211+i*1.2035;-1.2077]
dir:      0
pmul:     [1;1;1]
iunits:   []
ounits:   []
-------------------

or in a plist

>> rat = rational([1 2 3], [4 5 6 7], 'my rational');
>> pl  = plist('rational', rat)
>> pf  = parfrac(pl)

Construct an parfrac object from a pole/zero model

The following example creates a new parfrac object from a pole/zero model.

>> pzm = pzmodel(1, {1 2 3}, {4 5})
---- pzmodel 1 ----
    name: None
    gain: 1
   delay: 0
  iunits: []
  ounits: []
pole 001: (f=1 Hz,Q=NaN)
pole 002: (f=2 Hz,Q=NaN)
pole 003: (f=3 Hz,Q=NaN)
zero 001: (f=4 Hz,Q=NaN)
zero 002: (f=5 Hz,Q=NaN)
-------------------
>> pf = parfrac(pzm)
--- parfrac 1 ----
model:    parfrac(None)
res:      [0.999999999999999;-6.00000000000001;5.99999999999999]
poles:    [-18.8495559215388;-12.5663706143592;-6.28318530717959]
dir:      0
pmul:     [1;1;1]
iunits:   []
ounits:   []
-------------------

or in a plist

>> pzm = pzmodel(1, {1 2 3}, {4 5})
>> pl  = plist('pzmodel', pzm)
>> pf  = parfrac(pl)

Construct an parfrac object from residuals, poles and direct terms

The following example creates a new parfrac direct from the values.

>> res    = [1;2+i*1;2-i*1];
>> poles  = [6;1+i*3;1-i*3];
>> dir    = 3;
>> name   = 'my parfrac';
>> iunits = 'Hz';
>> ounits = 'V';

>> pf = parfrac(res, poles, dir)
>> pf = parfrac(res, poles, dir, name)
>> pf = parfrac(res, poles, dir, name, iunits, ounits)
---- parfrac 1 ----
model:    my parfrac
res:      [1;2+i*1;2-i*1]
poles:    [6;1+i*3;1-i*3]
dir:      3
pmul:     [1;1;1]
iunits:   [Hz]
ounits:   [V]
-------------------

Construct an parfrac object from a parameter list (plist)

Constructs an parfrac object from the description given in the parameter list.

Use the key word 'hostname'
Use the key word 'res' or 'poles' or 'dir'

Use the key word 'hostname'

Construct an parfrac object by retrieving it from a LTPDA repository.

The relevant parameters are:

Key Description

'hostname'

the repository hostname. [default: 'localhost']

'database'

The database name [default: 'ltpda']

'id'

A vector of object IDs. [default: []]

'cid'

Retrieve all parfrac objects from a particular collection

'binary'

Set to true to retrieve from stored binary representation (not always available). [default: true]

pl = plist('hostname', '130.75.117.67', 'database', 'ltpda_test', 'id', 1)
a1 = parfrac(pl)

Use the key word 'res' or 'poles' or 'dir'

Construct an parfrac object direct from the residual, pole or direct terms.

The relevant parameters are:

Key Description

'res'

residuals [default: []]

'poles'

poles [default: []]

'dir'

direct terms [default: []]

You can also specify optional parameters:

Key Description

'name'

name of the parfrac object [default: 'none']

'xunits'

unit of the x-axis

'yunits'

unit of the y-axis

res    = [1;2+i*1;2-i*1];
poles  = [6;1+i*3;1-i*3];
dir    = 3;
name   = 'my parfrac';
iunits = 'Hz';
ounits = 'V';

pl = plist('res', res, 'poles', poles);
pf = parfrac(pl)
---- parfrac 1 ----
model:    None
res:      [1;2+i*1;2-i*1]
poles:    [6;1+i*3;1-i*3]
dir:      0
pmul:     [1;1;1]
iunits:   []
ounits:   []
-------------------

pl = plist('res', res, 'poles', poles, 'name', name, 'iunits', iunits, 'ounits', ounits);
pf = parfrac(pl)
---- parfrac 1 ----
model:    my parfrac
res:      [1;2+i*1;2-i*1]
poles:    [6;1+i*3;1-i*3]
dir:      0
pmul:     [1;1;1]
iunits:   [Hz]
ounits:   [V]
-------------------



©LTP Team