Next: Filtering sinusoids
Up: Filters
Previous: Filters
Contents
Scilab has a lot of facilities to face digital filtering of signals. If we want to filter a signal, the process comprises two steps: the design of the filter and the application of the filter to the signal. Imagine that we have a signal called `inpsig' and we want to obtain a filtered signal called `outsig'. To filter the signal we are going to design a filter that will be called `lisys' :
-->lisys = iir (4, 'hp' , 'butt', [.05 0], [0 0]);
-->outsig = flts (inpsig, lisys);
The first command (`iir') designs the filter, the second one (`flts') applies the filter to `inpsig' to get `outsig'. The application of the filter is a very easy task: we introduce the signal and the filter and obtain the result. The design of the filter is a difficult process that we are going to detail just now. There are many ways to design filters in Scilab. In this chapter we are going to describe the use of the command `iir'. This command needs several parameters:
- The first option ('4' in our case) is a positive integer that specifies the order of the filter.
- We can use filters in very different ways. One of the most frequent objectives is to eliminate high or low frequencies. If we want to eliminate high frequencies we need to design a `low pass' filter, and if we need to eliminate low frequencies we want to design a `high pass' filter. We indicate this to `iir' in the second option; `hp' indicates a `high pass' filter and `lp' indicates a `low pass' filter.
- The third option indicates the design of the filter. There are several different designs that can be used with `iir'. We are going to use a Butterworth filter. The third option ('butt') indicates that we are using this design (other alternatives are 'cheb1','cheb2' or 'ellip').
- Once we have decided that we want to eliminate high or low frequencies, we have to decide the cut-off frequency. This is indicated in the forth option `[0.05 0]'. Unless we want to design a bandpass or a stopband filter, only the first value is considered. Frequencies span from `0' to `0.5' being `0.5' the Nyquist frequency. If we try to introduce a value above 0.5, `iir' returns an error message.
- The last option is not used in Butterworth filters but we have to adjust it to a vector `[0 0]'.
Next: Filtering sinusoids
Up: Filters
Previous: Filters
Contents
j
2003-01-23