Apply pulse shaping by decimating signal using raised cosine filter
The Raised Cosine Receive Filter System object™ applies pulse-shaping by decimating an input signal using a raised cosine FIR filter.
To decimate the input signal:
H = comm.RaisedCosineReceiveFilter returns a raised cosine receive filter System object, H, which decimates the input signal. The filter uses an efficient polyphase FIR decimation structure and has unit energy.
H = comm.RaisedCosineReceiveFilter(PropertyName,PropertyValue, ...) returns a raised cosine receive filter object, H, with each specified property set to the specified value.
Specify the filter shape as one of Normal or Square root. The default is Square root.
Specify the rolloff factor as a scalar between 0 and 1. The default is 0.2.
Filter span in symbols
Specify the number of symbols the filter spans as an integer-valued positive scalar. The default is 10. Because the ideal raised cosine filter has an infinite impulse response, the object truncates the impulse response to the value you specify for this property.
Input samples per symbol
Specify the number of input samples that represent a symbol. The default is 8. This property accepts an integer-valued, positive double or single scalar value. The raised cosine filter has (FilterSpanInSymbols x InputSamplesPerSymbol + 1) taps.
Specify the factor by which the object reduces the sampling rate of the input signal. The default value is 8. This property accepts a positive integer scalar value between 1 and InputSamplesPerSymbol. The value must evenly divide into InputSamplesPerSymbol. The number of input rows must be a multiple of the decimation factor. If you set DecimationFactor to 1, then the object only applies filtering without downsampling.
Specify the number of filtered samples the System object discards before downsampling. The default is 0. This property accepts an integer valued scalar between 0 and DecimationFactor − 1.
Linear filter gain
Specify the linear gain of the filter as a positive numeric scalar. The default is 1. The object designs a raised cosine filter that has unit energy, and then applies the linear gain to obtain final tap values.
|clone||Create RaisedCosineReceiveFilter object with same property values|
|coeffs||Returns coefficients for filters|
|isLocked||Locked status for input attributes and nontunable properties|
|release||Allow property value and input characteristics changes|
|reset||Reset internal states of System object|
|step||Output decimated values of input signal|
Filter the output of a square root raised cosine transmit filter using a matched square root raised cosine receive filter. The input signal has eight samples per symbol.
Create a raised cosine transmit filter and set the OutputSamplesPerSymbol property to 8.
hTxFilt = comm.RaisedCosineTransmitFilter('OutputSamplesPerSymbol',8);
Create a raised cosine receive filter and set the InputSamplesPerSymbol property to 8 and the DecimationFactor property to 8.
hRxFilt = comm.RaisedCosineReceiveFilter('InputSamplesPerSymbol',8, ... 'DecimationFactor',8);
Use the coeffs method to determine the filter coefficients for both filters.
txCoef = coeffs(hTxFilt); rxCoef = coeffs(hRxFilt);
Launch the filter visualization tool and display the magnitude responses of the two filters. Observe that they have identical responses.
hfv = fvtool(txCoef.Numerator,1,rxCoef.Numerator,1); legend(hfv,'Tx Filter','Rx Filter')
Generate a random bipolar signal and then interpolate.
x = 2*randi([0 1],100,1) - 1; y = step(hTxFilt,x);
Call the step method to decimate the signal using the raised cosine receive filter System object.
z = step(hRxFilt,y);
The filter delay is equal to the FilterSpanInSymbols property. Adjust for the delay to compare the pre-Tx filter signal, x, with the post-Rx filter signal, z.
delay = hTxFilt.FilterSpanInSymbols; plot(x(1:end-delay)) hold on plot(z(delay+1:end)) legend('Pre-Tx Filter','Post-Rx Filter')
You can see that the two signals overlap one another since the receive filter is matched to the transmit filter.
Decimate a bipolar signal using a square root raised cosine filter whose impulse response is truncated to six symbol durations.
Create a raised cosine transmit filter and set the FilterSpanInSymbols property to 6. The object truncates the impulse response to six symbols.
hTxFilt = comm.RaisedCosineTransmitFilter('FilterSpanInSymbols',6);
Generate a random bipolar signal and filter it using hTxFilt.
x = 2*randi([0 1],25,1) - 1; y = step(hTxFilt,x);
Create a matched raised cosine receive filter System object.
hRxFilt = 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 using the matched receive filter object, hRxFilt.
r = step(hRxFilt,y);
Plot the interpolated signal. Because of the filter span, there is a delay of six symbols before data passes through the filter.
Create a raised cosine receive filter with unity passband gain.
Create a raised cosine receive filter System object™. Obtain the filter coefficients using the coeffs method.
h = comm.RaisedCosineReceiveFilter; b = coeffs(h);
A filter with unity passband gain has filter coefficients such that the sum of coefficients is 1. Therefore, set the Gain property to the inverse of the sum of b.Numerator.
h.Gain = 1/sum(b.Numerator);
Verify that the sum of the coefficients from the resulting filter equal 1.
bNorm = coeffs(h); sum(bNorm.Numerator)
ans = 1.0000
Plot the frequency response of the fitler. Note that it shows a passband gain of 0 dB, which is unity gain.