Raised cosine FIR pulse-shaping filter design
returns the coefficients
b = rcosdesign(
correspond to a square-root raised cosine FIR filter with
rolloff factor specified by
filter is truncated to
and each symbol period contains
samples. The order of the filter,
sps*span, must be even. The
filter energy is 1.
Design a Square-Root Raised Cosine Filter
Specify a rolloff factor of 0.25. Truncate the filter to 6 symbols and represent each symbol with 4 samples. Verify that
'sqrt' is the default value of the
h = rcosdesign(0.25,6,4); mx = max(abs(h-rcosdesign(0.25,6,4,'sqrt')))
mx = 0
Impulse Responses of Normal and Square-Root Raised Cosine Filters
Compare a normal raised cosine filter with a square-root cosine filter. An ideal (infinite-length) normal raised cosine pulse-shaping filter is equivalent to two ideal square-root raised cosine filters in cascade. Thus, the impulse response of an FIR normal filter should resemble that of a square-root filter convolved with itself.
Create a normal raised cosine filter with rolloff 0.25. Specify that this filter span 4 symbols with 3 samples per symbol.
rf = 0.25; span = 4; sps = 3; h1 = rcosdesign(rf,span,sps,"normal"); impz(h1)
The normal filter has zero crossings at integer multiples of
sps. It thus satisfies Nyquist's criterion for zero intersymbol interference. The square-root filter, however, does not:
h2 = rcosdesign(rf,span,sps,"sqrt"); impz(h2)
Convolve the square-root filter with itself. Truncate the impulse response outward from the maximum so it has the same length as
h1. Normalize the response using the maximum. Compare the convolved square-root filter to the normal filter.
h3 = conv(h2,h2,"same"); stem(0:span*sps,[h1/max(abs(h1));h3/max(abs(h3))]',"filled") xlabel("Samples") ylabel("Normalized Amplitude") legend("h1","h2 * h2")
The convolved response does not coincide with the normal filter because of its finite length. Increase
span to obtain closer agreement between the responses and better compliance with the Nyquist criterion.
Pass a Signal through a Raised Cosine Filter
This example shows how to pass a signal through a square-root, raised cosine filter.
Specify the filter parameters.
rolloff = 0.25; % Rolloff factor span = 6; % Filter span in symbols sps = 4; % Samples per symbol
Generate the square-root, raised cosine filter coefficients.
b = rcosdesign(rolloff, span, sps);
Create a vector of bipolar data.
d = 2*randi([0 1], 100, 1) - 1;
Upsample and filter the data for pulse shaping.
x = upfirdn(d, b, sps);
r = x + randn(size(x))*0.01;
Filter and downsample the received signal for matched filtering.
y = upfirdn(r, b, 1, sps);
For information on how to use square-root, raised cosine filters to interpolate and decimate signals, see Interpolate and Decimate Using RRC Filter (Communications Toolbox).
beta — Rolloff factor
real nonnegative scalar
Rolloff factor, specified as a real nonnegative scalar not greater than 1. The rolloff factor determines the excess bandwidth of the filter. Zero rolloff corresponds to a brick-wall filter and unit rolloff to a pure raised cosine.
span — Number of symbols
positive integer scalar
Number of symbols, specified as a positive integer scalar.
sps — Samples per symbol
positive integer scalar
Number of samples per symbol (oversampling factor), specified as a positive integer scalar.
shape — Shape of the raised cosine window
"sqrt" (default) |
Shape of the raised cosine window, specified as either
b — FIR filter coefficients
Raised cosine filter coefficients, returned as a row vector.
If you have a license for Communications Toolbox™ software, you can perform multirate raised cosine filtering with streaming behavior. To do so, use the System object™ filters,
 Tranter, William H., K. Sam Shanmugan, Theodore S. Rappaport, and Kurt L. Kosbar. Principles of Communication Systems Simulation with Wireless Applications. Upper Saddle River, NJ: Prentice Hall, 2004.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Introduced in R2013b