Apply pulse shaping by interpolating signal using raised cosine filter
Raised Cosine Transmit Filter System
pulse-shaping by interpolating an input signal using a raised cosine
To interpolate the input signal:
Starting in R2016b, instead of using the
to perform the operation defined by the System
object, you can
call the object with arguments, as if it were a function. For example,
= step(obj,x) and
y = obj(x) perform
H = comm.RaisedCosineTransmitFilter returns
a raised cosine transmit filter System object,
which interpolates an input signal using a raised cosine FIR filter.
The filter uses an efficient polyphase FIR interpolation structure
and has unit energy.
H = comm.RaisedCosineTransmitFilter( returns a raised cosine transmit filter object,
with each specified property set to the specified value.
Specify the filter shape as one of
Specify the rolloff factor as a scalar between
Filter span in symbols
Specify the number of symbols the filter spans as an integer-valued,
positive scalar. The default is
Output samples per symbol
Specify the number of output samples for each input symbol. The default is
Linear filter gain
Specify the linear gain of the filter as a positive numeric
scalar. The default is
|coeffs||Returns coefficients for filters|
|reset||Reset internal states of System object|
|step||Output interpolated values of input signal|
|Common to All System Objects|
Allow System object property value changes
This example shows how to interpolate a signal using the
comm.RaisedCosineTransmitFilter System object and to display its spectrum.
Create a square root raised square root cosine transmit filter object. You can see that its default settings are such that the filter has a square root shape and that there are 8 samples per symbol.
txfilter = comm.RaisedCosineTransmitFilter
txfilter = comm.RaisedCosineTransmitFilter with properties: Shape: 'Square root' RolloffFactor: 0.2000 FilterSpanInSymbols: 10 OutputSamplesPerSymbol: 8 Gain: 1
Generate random bipolar data.
data = 2*randi([0 1],10000,1) - 1;
Filter the data by using the RRC filter.
filteredData = txfilter(data);
To view the spectrum of the filtered signal, create a spectrum analyzer object with a sample rate of 1000 Hz.
spectrumAnalyzer = dsp.SpectrumAnalyzer('SampleRate',1000);
View the spectrum of the filtered signal using the spectrum analyzer.
This example shows to create an interpolated signal from a square root raised cosine filter that is truncated to six symbol durations.
Create a raised cosine filter and set the
FilterSpanInSymbols to 6. The object truncates the impulse response to six symbols.
txfilter = comm.RaisedCosineTransmitFilter('FilterSpanInSymbols',6);
Launch the filter visualization tool to show the impulse response.
Generate random bipolar data and pass it through the filter.
x = 2*randi([0 1],96,1) - 1; y = txfilter(x);
Plot the interpolated signal.
plot(y) grid on
This example shows how to create a raised cosine transmit filter with unity passband gain.
Generate a filter with unit energy. You can obtain the filter coefficients using the
txfilter = comm.RaisedCosineTransmitFilter; b = coeffs(txfilter);
Plot the filter response. You can see that its gain is greater than unity (more than 0 dB).
A filter with unity passband gain has filter coefficients that sum to 1. Set the
Gain property to the inverse of the sum of
txfilter.Gain = 1/sum(b.Numerator);
Verify that the resulting filter coefficients sum to 1.
bNorm = coeffs(txfilter); sum(bNorm.Numerator)
ans = 1.0000
Plot the filter frequency response. Note that it shows a passband gain of 0 dB.
Usage notes and limitations:
See System Objects in MATLAB Code Generation (MATLAB Coder).