Products & Services Industries Academia Support User Community Company

Learn more about MATLAB   

idealfilter (timeseries) - Apply ideal (noncausal) filter to timeseries object

Syntax

ts2 = idealfilter(ts1,Interval,FilterType)
ts2 = idealfilter(ts1,Interval,FilterType,Index)

Description

ts2 = idealfilter(ts1,Interval,FilterType) applies an ideal filter of FilterType 'pass' or 'notch' to one or more frequency intervals specified by Interval for the timeseries object ts1. You specify several frequency intervals as an n-by-2 array of start and end frequencies, where n represents the number of intervals.

ts2 = idealfilter(ts1,Interval,FilterType,Index) applies an ideal filter and uses the optional Index integer array to specify the columns or rows to filter. When ts.IsTimeFirst is set to true, Index specifies one or more data columns. When ts.IsTimeFirst is set to false, Index specifies one or more data rows.

Remarks

When to Use the Ideal Filter

You use the ideal notch filter when you want to remove variations in a specific frequency range. Alternatively, you use the ideal pass filter to allow only the variations in a specific frequency range.

These filters are ideal in the sense that they are not realizable; an ideal filter is noncausal and the ends of the filter amplitude are perfectly flat in the frequency domain.

Requirement for Uniform Samples in Time

If the time-series data is sampled nonuniformly, filtering resamples this data on a uniform time vector.

Interpolation of NaN Values

All NaNs in the time series are interpolated before filtering using the interpolation method you assigned to the timeseries object.

Examples

You will apply an ideal notch filter to the data in count.dat.

  1. Load the matrix count into the workspace.

    load count.dat;
    
  2. Create a timeseries object based on this matrix. The time vector ranges from 1 to 24 seconds in 1-second intervals.

    count1=timeseries(count(:,1),1:24);
    
  3. Enter the frequency interval in hertz.

    interval=[0.08 0.2];
    
  4. Call the filter function:

    idealfilter_count = idealfilter(count1,interval,'notch')
    
  5. 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

filter (timeseries), timeseries

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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