Constructor examples of the TSDATA class


Construct empty TSDATA object
Construct a TSDATA object by loading the object from a file
Construct a TSDATA object from a data vector
Construct a TSDATA object from a data vector and time vector
Construct a TSDATA object from a data vector and the corresponding frequency

Construct empty TSDATA object

The following example creates an empty tsdata object

ts = tsdata()
-------- tsdata 01 ------------

  name:  None
    fs:  0
     x:  [0 0], double
     y:  [0 0], double
xunits:
yunits:
 nsecs:  0
    t0:  1970-01-01 00:00:00.000
-------------------------------

Construct a TSDATA object by loading the object from a file

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

tsd = tsdata('tsd.mat')
tsd = tsdata('tsd.xml')

Construct a TSDATA object from a data vector

Creates a time-series object with the given x-data. Sample rate of the data is assumed to be 1Hz.

y  = randn(1000,1);

tsd = tsdata(y)

Construct a TSDATA object from a data vector and time vector

Creates a time-series object with the given (t,x)-data. The sample rate is then set as 1/(t(2)-t(1)).

fs = 10;
x  = linspace(0, fs/2, 1000);
y  = randn(1000,1);

f1 = tsdata(x,y)

Construct a TSDATA object from a data vector and the corresponding frequency

creates a time-series object with the given x-data. The time vector t[] is grown from the sample rate. The first sample is assigned time 0.

y = randn(1000,1);
fs = 100;

tsd = tsdata(y,fs)




©LTP Team