LTPDA Toolbox™ | contents | ![]() ![]() |
The following example creates a copy of an rational object (blue command).
>> ra1 = rational([1 2 3], [4 5 6 7], 'my rational'); >> ra2 = rational(ra1) ---- rational 1 ---- model: my rational num: [1 2 3] den: [4 5 6 7] 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.
>> ra1 = rational() ---- rational 1 ---- model: none num: [] den: [] iunits: [] ounits: [] -------------------- >> ra2 = ra1; >> ra2.setName('my new name') ---- rational 1 ---- model: my new name num: [1 2 3] den: [4 5 6 7] iunits: [] ounits: [] --------------------
If we display ra1 again then we see that the property 'name' was changed although we only have changed ra2.
>> ra1
---- rational 1 ----
model: my new name
num: [1 2 3]
den: [4 5 6 7]
iunits: []
ounits: []
--------------------
The following example creates a new rational object by loading the object from disk.
ra = rational('rational_object.mat') ra = rational('rational_object.xml')
or in a PLIST
pl = plist('filename', 'rational_object.xml'); ra = rational(pl)
The following example creates a new rational object from an parfrac object.
>> pf = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], 3, 'my parfrac')
---- 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: []
ounits: []
-------------------
>> ra = rational(pf)
---- rational 1 ----
model: rational(my parfrac)
num: [3 -19 30 -110]
den: [1 -8 22 -60]
iunits: []
ounits: []
--------------------
or in a plist
>> pf = parfrac([1 2+1i 2-1i], [6 1+3i 1-3i], 3, 'my parfrac'); >> pl = plist('rational', rat) >> ra = rational(pl)
The following example creates a new rational object from a pole/zero model.
>> pzm = pzmodel(1, {1 2 3}, {4 5}, 'my pzmodel')
---- pzmodel 1 ----
name: my pzmodel
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)
-------------------
>> ra = rational(pzm)
---- rational 1 ----
model: rational(None)
num: [0.0012 0.0716 1]
den: [0.0001 0.0036 0.0401 0.2122 1]
iunits: []
ounits: []
--------------------
or in a plist
>> pzm = pzmodel(1, {1 2 3}, {4 5}, 'my pzmodel') >> pl = plist('pzmodel', pzm) >> ra = rational(pl)
The following example creates a new rational direct from the numerator and denominator coefficients.
>> num = [1 2 3]; >> den = [4 5 6]; >> name = 'my rational'; >> iunits = 'Hz'; >> ounits = 'V'; >> ra = rational(num, den) >> ra = rational(num, den, name) >> ra = rational(num, den, name, iunits, ounits) ---- rational 1 ---- model: my rational num: [1 2 3] den: [4 5 6] iunits: [Hz] ounits: [V] --------------------
Constructs an rational object from the description given in the parameter list.
Use the key word 'hostname' |
Use the key word 'num' or 'den' |
Construct an rational 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 rational 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 = rational(pl)
Construct an rational object direct from the coefficients.
The relevant parameters are:
Key | Description |
---|---|
'num' |
numerator coefficients [default: []] |
'den' |
denominator coefficients [default: []] |
You can also specify optional parameters:
Key | Description |
---|---|
'name' |
name of the rational object [default: 'none'] |
'xunits' |
unit of the x-axis |
'yunits' |
unit of the y-axis |
num = [1 2 3]; den = [4 5 6]; name = 'my rational'; iunits = 'Hz'; ounits = 'V'; pl = plist('num', num, 'den', den); ra = rational(pl) ---- rational 1 ---- model: None num: [1 2 3] den: [4 5 6] iunits: [] ounits: [] -------------------- pl = plist('num', num, 'den', den, 'name', name, 'iunits', iunits, 'ounits', ounits); pf = rational(pl) ---- rational 1 ---- model: my rational num: [1 2 3] den: [4 5 6] iunits: [Hz] ounits: [V] --------------------
![]() |
Constructor examples of the PARFRAC class | Constructor examples of the TIMESPAN class | ![]() |
©LTP Team