Skip to Main Content Skip to Search
Product Documentation

filter - Class: timeseries

Shape frequency content of time-series

Syntax

ts1 = filter(ts, numerator, denominator)
ts1=filter(ts, numerator, denominator, index)

Description

ts1 = filter(ts, numerator, denominator) applies the transfer function filter b(z−1)/a(z−1) to the data in the timeseries object ts. b and a are the coefficient arrays of the transfer function numerator and denominator, respectively.

ts1=filter(ts, numerator, denominator, index) uses the optional index integer array to specify either the columns or rows to filter, depending on the value of ts.IsTimeFirst.

Tips

Input Arguments

ts

The first timeseries object for which you want to shape the frequency content.

numerator

The coefficient array of the transfer function numerator.

denominator

The coefficient array of the transfer function denominator.

index

An integer array that specifies the columns or rows to filter when ts.IsTimeFirst is true.

Output Arguments

ts1

The timeseries object that results from filtering the input timeseries object.

Examples

This example applies the following transfer function to the data in count.dat:

% Load the matrix count into the workspace:

load count.dat;

% Create a time-series object based on this matrix:

count1=timeseries(count(:,1),[1:24]);

% Enter the coefficients of the denominator ordered in 
% ascending powers of z-1 to 
% 	represent 1 + 0.2x-1:

a = [1 0.2];

% Enter the coefficients of the numerator to represent 2 - 3z-1:

b = [2 3];

% Call the filter method:

filter_count = filter(count1, b, a)

% Compare the original data and the shaped data with an 
% overlaid plot of the two curves:

plot(count1,'-.'), grid on, hold on
plot(filter_count,'-')
legend('Original Data','Shaped Data',2)

See Also

idealfilter | timeseries

  


» Learn more
» Download free kit
» Get trial software

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS