Main Content

Design Raised Cosine Filters Using MATLAB Functions

Section Overview

The rcosdesign function designs (but does not apply) filters of these types:

  • Finite impulse response (FIR) raised cosine filter

  • FIR square-root raised cosine filter

The function returns the FIR coefficients as output.

Example Designing a Square-Root Raised Cosine Filter

For example, the command below designs a square-root raised cosine FIR filter with a roll-off of 0.25, a filter span of 6 symbols, and an oversampling factor of 2.

sps = 2;
num = rcosdesign(0.25, 6, sps)
num =
  Columns 1 through 7
   -0.0265    0.0462    0.0375   -0.1205   -0.0454    0.4399    0.7558
  Columns 8 through 13
    0.4399   -0.0454   -0.1205    0.0375    0.0462   -0.0265

Here, the vector num contains the coefficients of the filter, in ascending order of powers of z-1.

You can use the upfirdn function to filter data with a raised cosine filter generated by rcosdesign. The following code illustrates this usage:

d = 2*randi([0 1], 100, 1)-1;
f = upfirdn(d, num, sps);

The eye diagram shows an imperfect eye because num characterizes a square-root filter.