Main Content

filter

Linear filtering

filter is not recommended. Use timetable instead. For more information, see Convert Financial Time Series Objects fints to Timetables.

Description

example

NewFts = filter(b,a,OldFts) applies filters a and b on a whole financial time series object with a filter specification.

The filter is a “Direct Form II Transposed” implementation of the standard difference equation. NewFts is a financial time series object containing the same data series (names) as the input OldFts.

Examples

collapse all

  1. Create a fints object.

    dates_and_times = (now:now+5)'
    dates_and_times =
    
       1.0e+05 *
    
        7.3840
        7.3840
        7.3840
        7.3841
        7.3841
        7.3841
    
     tsobj = fints(dates_and_times, randn(6,1))
    Warning: FINTS is not recommended. Use TIMETABLE instead. 
    For more information, see Convert Financial Time Series Objects (fints) to Timetables. 
    > In fints (line 169) 
    tsobj = 
     
        desc:  (none)
        freq:  Unknown (0)
    
        {'dates:  (6)'}    {'times:  (6)'}    {'series1:  (6)'}
        {'03-Sep-2021'}    {'17:10'      }    {[       1.4193]}
        {'04-Sep-2021'}    {'17:10'      }    {[       0.2916]}
        {'05-Sep-2021'}    {'17:10'      }    {[       0.1978]}
        {'06-Sep-2021'}    {'17:10'      }    {[       1.5877]}
        {'07-Sep-2021'}    {'17:10'      }    {[      -0.8045]}
        {'08-Sep-2021'}    {'17:10'      }    {[       0.6966]}
  2. Apply linear filters to tsobj.

    b = 1;
    a = [1 -0.2];
    NewFts = filter(b, a, tsobj)
    Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, 
    see Convert Financial Time Series Objects (fints) to Timetables. 
    > In fints/filter (line 22) 
     
    NewFts = 
     
        desc:  FILTERed 
        freq:  Unknown (0)
    
        {'dates:  (6)'}    {'times:  (6)'}    {'series1:  (6)'}
        {'04-May-2022'}    {'15:17'      }    {[      -0.4336]}
        {'05-May-2022'}    {'15:17'      }    {[       0.2559]}
        {'06-May-2022'}    {'15:17'      }    {[       3.6296]}
        {'07-May-2022'}    {'15:17'      }    {[       3.4954]}
        {'08-May-2022'}    {'15:17'      }    {[      -0.6508]}
        {'09-May-2022'}    {'15:17'      }    {[       2.9048]}

Input Arguments

collapse all

Filter, specified as a scalar or vector.

Data Types: double

Filter, specified as a scalar or vector.

Data Types: double

Financial time series object, specified as a fints object.

Data Types: object

Output Arguments

collapse all

Filtered financial time series object, returned as an updated financial time series object.

Version History

Introduced before R2006a