Apply pulse shaping by decimating signal using raised-cosine FIR filter
System object™ applies pulse shaping by decimating an input signal using a raised-cosine
finite impulse response (FIR) filter. The FIR filter has
InputSamplesPerSymbol + 1) tap coefficients.
To apply pulse shaping by decimating an input signal using a raised-cosine FIR filter:
comm.RaisedCosineReceiveFilterobject and set its properties.
Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?
returns a raised-cosine FIR receive filter System object, which decimates the input signal using a raised-cosine FIR
filter. The filter uses an efficient polyphase FIR decimation structure and has
rxfilter = comm.RaisedCosineReceiveFilter
sets properties using one or more name-value pairs. Enclose each property name
in quotes. For example,
rxfilter = comm.RaisedCosineReceiveFilter(Name,Value)
configures a raised-cosine receive filter System object with the roll-off factor set to
Unless otherwise indicated, properties are nontunable, which means you cannot change their
values after calling the object. Objects lock when you call them, and the
release function unlocks them.
If a property is tunable, you can change its value at any time.
For more information on changing property values, see System Design in MATLAB Using System Objects.
Shape — Filter shape
Square root (default) |
Filter shape, specified as
'Square root' or
RolloffFactor — Roll-off factor
0.2 (default) | scalar in the range [0, 1]
Roll-off factor, specified as a scalar in the range [0, 1].
FilterSpanInSymbols — Filter span in symbols
10 (default) | positive integer
Filter span in symbols, specified as a positive integer. The object truncates the infinite impulse response (IIR) of an ideal raised-cosine filter to an impulse response that spans the number of symbols specified by this property.
InputSamplesPerSymbol — Input samples per symbol
8 (default) | positive integer
Input samples per symbol, specified as a positive integer.
DecimationFactor — Decimation factor
8 (default) | integer
Decimation factor, specified as an integer in the range [1,
InputSamplesPerSymbol]. This value must evenly
InputSamplesPerSymbol. The sampling rate of
the output signal is reduced by the decimation factor such that
is equal to
DecimationFactor. For a matrix input
signal, the number of input rows must be a multiple of the decimation
DecimationOffset — Decimation offset
0 (default) | integer
Decimation offset, specified as an integer in the range [0,
DecimationFactor − 1)]. This property specifies
the number of filtered samples the object discards before
Gain — Linear filter gain
1 (default) | positive scalar
Linear filter gain, specified as a positive scalar. The object designs a raised-cosine filter that has unit energy and then applies the linear filter gain to obtain final tap coefficient values.
x — Input signal
column vector | matrix
Input signal, specified as a column vector or a Ki-by-N matrix. Ki is the number of input samples per signal channel, and N is the number of signal channels.
For a Ki-by-N matrix input, the object processes columns of the input matrix as N independent channels.
Complex Number Support: Yes
y — Output signal
column vector | matrix
Output signal, returned as a column vector or a
matrix. Ko is equal to
Ki is the number of input
samples per signal channel, and N is the number of
The System object filters each channel over time and generates a Ko-by-N output matrix. The output signal is the same data type as the input signal.
To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named
|Information about filter System object|
|Coefficients for filters|
|Computational cost of implementing filter System object|
|Frequency response of discrete-time filter|
|Plot frequency response of filter|
|Group delay response of discrete-time filter|
|Impulse response of discrete-time filter|
|Order of discrete-time filter System object|
Filter Signal Using Square-Root-Raised-Cosine Receive Filter
Filter the output of a square-root-raised-cosine (SRRC) transmit filter by using a matched SRRC receive filter. The input signal has eight samples per symbol.
Create an SRRC transmit filter object, setting the number of output samples per symbol to 8.
txfilter = comm.RaisedCosineTransmitFilter('OutputSamplesPerSymbol',8);
Create an SRRC receive filter, setting the number of input samples per symbol to 8 and the decimation factor to 8.
rxfilter = comm.RaisedCosineReceiveFilter('InputSamplesPerSymbol',8, ... 'DecimationFactor',8);
coeffs function to determine the filter coefficients for both filters.
txCoef = coeffs(txfilter); rxCoef = coeffs(rxfilter);
Launch the filter visualization tool and display the magnitude responses of the two filters. The results show that the responses are the same.
fvt = fvtool(txCoef.Numerator,1,rxCoef.Numerator,1); legend(fvt,'Tx Filter','Rx Filter')
Generate a random bipolar signal. Interpolate the signal by using the SRRC transmit filter object.
preTx = 2*randi([0 1],100,1) - 1; y = txfilter(preTx);
Decimate the signal by using the SRRC receive filter object.
postRx = rxfilter(y);
The filter delay is equal to the filter span. Accounting for the filter delay, adjust the plotted samples to compare the pre-Tx filter signal with the post-Rx filter signal. Because the combined receive and the transmit RRC filters generate a matched filter pair, the two signals overlap one another.
delay = txfilter.FilterSpanInSymbols; x = (1:(length(preTx)-delay)); plot(x,preTx(1:end-delay),x,postRx(delay+1:end)) legend('Pre-Tx filter','Post-Rx filter')
Specify Filter Span of Square-Root-Raised-Cosine Receive Filter
Decimate a bipolar signal using a square-root-raised-cosine (SRRC) filter whose impulse response is truncated to filter a span of six symbol durations.
Create a SRRC transmit FIR filter, setting the filter span to six symbols. The object truncates the impulse response to six symbols.
txfilter = comm.RaisedCosineTransmitFilter('FilterSpanInSymbols',6);
Generate a random bipolar signal . Filter the signal by using the SRRC transmit FIR filter object.
x = 2*randi([0 1],25,1) - 1; y = txfilter(x);
Create a matched SRRC receive filter object.
rxfilter = comm.RaisedCosineReceiveFilter('FilterSpanInSymbols',6);
Launch the filter visualization tool to show the impulse response of the receive filter.
Filter the output signal from the transmit filter by using the matched SRRC receive filter object.
r = rxfilter(y);
Plot the interpolated signal. The results show a delay equal to the filter span (six symbols) before data passes through the filter.
Create Square-Root-Raised-Cosine Receive Filter with Unity Passband Gain
Create a square-root-raised-cosine (SRRC) receive filter object. Use FVTool to plot the filter response. The results show that the linear filter gain is greater than unity. Specifically, the passband gain is more than 0 dB.
rxfilter = comm.RaisedCosineReceiveFilter; fvtool(rxfilter)
coeffs object function to obtain the filter coefficients and adjust the filter gain to unit energy.
b = coeffs(rxfilter);
Because a filter with unity passband gain must have filter coefficients that sum to 1, set the linear filter gain to the inverse of the sum of the filter tap coefficients,
rxfilter.Gain = 1/sum(b.Numerator);
Verify that the resulting filter coefficients sum to 1.
bNorm = coeffs(rxfilter); sum(bNorm.Numerator)
ans = 1.0000
Plot the filter frequency response. The results now show that the passband gain is 0 dB, which is unity gain.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
See System Objects in MATLAB Code Generation (MATLAB Coder).
System object supports SIMD code generation using Intel AVX2 technology under these
Input signal is real-valued with real filter coefficients.
Input signal is complex-valued with real or complex filter coefficients.
Input signal has a data type of
The SIMD technology significantly improves the performance of the generated code. For details, see Generate SIMD Code for MATLAB Functions (Embedded Coder).
Introduced in R2013b