Communications Toolbox    

Filtering with Raised Cosine Filters

The rcosflt function applies a raised cosine filter to data. Because rcosflt is a versatile function, you can

This section discusses the use of sampling rates in filtering and then covers these options. For an additional example, type playshow rcosdemo in the MATLAB Command Window.

Sampling Rates

The basic rcosflt syntax

assumes by default that you want to apply the filter to a digital signal x whose sampling rate is Fd. The filter's sampling rate is Fs. The ratio of Fs to Fd must be an integer. By default, the function upsamples the input data by a factor of Fs/Fd before filtering. It upsamples by inserting Fs/Fd-1 zeros between consecutive input data samples. The upsampled data consists of Fs/Fd samples per symbol and has sampling rate Fs.

An example using this syntax is below. The output sampling rate is four times the input sampling rate.

Maintaining the Input Sampling Rate.   You can also override the default upsampling behavior. In this case, the function assumes that the input signal already has sampling rate Fs and consists of Fs/Fd samples per symbol. You might want to maintain the sampling rate in a receiver's filter if the corresponding transmitter's filter has already upsampled sufficiently.

To maintain the sampling rate, modify the fourth input argument in rcosflt to include the string Fs. For example, in the first command below, rcosflt uses its default upsampling behavior and the output sampling rate is four times the input sampling rate. By contrast, the second command below uses Fs in the string argument and thus maintains the sampling rate throughout.

The second command assumes that the sampling rate of the input signal is 4, and that the input signal contains 4/1 samples per symbol.

An example that uses the 'Fs' option at the receiver is in Combining Two Square-Root Raised Cosine Filters.

Designing Filters Automatically

The simplest syntax of rcosflt assumes that the function should both design and implement the raised cosine filter. For example, the command below designs an FIR raised cosine filter and then filters the input vector [1;0;0] with it. The second and third input arguments indicate that the function should upsample the data by a factor of 8 (that is, 8/1) during the filtering process.

Types of Raised Cosine Filters.   You can have rcosflt design other types of raised cosine filters by using a fourth input argument. Variations on the previous example are below.

Specifying Filters Using Input Arguments

If you have a transfer function for a raised cosine filter, then you can provide it as an input to rcosflt so that rcosflt does not design its own filter. This is useful if you want to use rcosine to design the filter once and then use the filter many times. For example, the rcosflt command below uses the 'filter' flag to indicate that the transfer function is an input argument. The input num is a vector that represents the FIR transfer function by listing its coefficients.

This syntax for rcosflt works whether num represents the transfer function for a square-root raised cosine FIR filter or an ordinary raised cosine FIR filter. For example, the code below uses a square-root raised cosine FIR filter. Only the definition of num is different.

You can also use a raised cosine IIR filter. To do this, modify the fourth input argument of the rcosflt command above so that it contains the string 'iir' and provide a denominator argument. An example is below.

Controlling the Rolloff Factor

If rcosflt designs the filter automatically, then you can control the rolloff factor of the filter, as described below. If you specify your own filter, then rcosflt does not need to know its rolloff factor.

The rolloff factor determines the excess bandwidth of the filter. For example, a rolloff factor of .5 means that the bandwidth of the filter is 1.5 times the input sampling frequency, Fd. This also means that the transition band of the filter extends from .5 * Fd to 1.5 * Fd.

The default rolloff factor is .5, but if you want to use a value of .2, then you can use a command such as the one below. Typical values for the rolloff factor are between .2 and .5.

Controlling the Group Delay

If rcosflt designs the filter automatically, then you can control the group delay of the filter, as described below. If you specify your own FIR filter, then rcosflt does not need to know its group delay.

The filter's group delay is the time between the filter's initial response and its peak response. The default group delay in the implementation is three input samples. To specify a different value, measure it in input symbol periods and provide it as the sixth input argument. For example, the command below specifies a group delay of six input samples, which is equivalent to 6 *8 /1 output samples.

The group delay influences the size of the output, as well as the order of the filter if rcosflt designs the filter automatically. See the reference page for rcosflt for details that relate to the syntax you want to use.

Example: Raised Cosine Filter Delays.   The code below filters a signal using two different group delays. A larger delay results in a smaller error in the frequency response of the filter. The plot shows how the two filtered signals differ, and the output pt indicates that the first peak occurs at different times for the two filtered signals. In the plot, the solid line corresponds to a delay of six samples, while the dashed line corresponds to a delay of eight samples.

If Fs/Fd is at least 4, then a group delay value of at least 8 works well in many cases. In the examples of this section, Fs/Fd is 8.

Delays of Six Samples (Solid) and Eight Samples (Dashed)

Combining Two Square-Root Raised Cosine Filters

If you want to split the filtering equally between the transmitter's filter and the receiver's filter, then you can use a pair of square-root raised cosine filters. In theory, the combination of two square-root raised cosine filters is equivalent to a single normal raised cosine filter. However, the limited impulse response of practical square-root raised cosine filters causes a slight difference between the response of two successive square-root raised cosine filters and the response of one raised cosine filter.

Using rcosine and rcosflt to Implement Square-Root Raised Cosine Filters.   One way to implement the pair of square-root raised cosine filters is to follow these steps:

  1. Use rcosine with the 'sqrt' flag to design a square-root raised cosine filter.
  2. Use rcosflt in the transmitter section of code to upsample and filter the data.
  3. Use rcosflt in the receiver section of code to filter the received data without upsampling it. Use the 'Fs' flag to avoid upsampling.

An example of this approach is below. Notice that the syntaxes for rcosflt use the 'filter' flag to indicate that you are providing the filter's transfer function as an input.

Using rcosflt Alone.   Another way to implement the pair of square-root raised cosine filters is to have rcosflt both design and use the square-root raised cosine filter. This approach avoids using rcosine. The corresponding example code is below. Notice that the syntaxes for rcosflt use the 'sqrt' flag to indicate that you want it to design a square-root raised cosine filter.

Because these two approaches are equivalent, y is the same as y1 and z is the same as z1.


  Raised Cosine Filters in Communication Systems Designing Raised Cosine Filters