rcosdesign
The design of the FIR pulse shaping filter with a "raised cosine" type characteristic.
| Library |
|
Syntax
Function call
-
b = rcosdesign(beta,span,sps)— returns coefficientsbcorresponding to the FIR filter with the "raised cosine" type characteristic (FPC) using the square root method and the slope of the decline specified by the argumentbeta. The filter is truncated to the specified character range.span, and each period of the symbol containsspscounts. Filter ordersps*spanmust be even. The energy of the filter is equal to1.
Arguments
Input arguments
# beta — steepness of the decline
+
a real non-negative scalar
Details
The slope of the decline, given as a real non-negative scalar, not exceeding 1. The steepness of the drop determines the excess bandwidth of the filter. The zero slope of the drop corresponds to a filter with a narrow profile, and the single slope corresponds to a pure elevated cosine.
| Data types |
|
# span — number of characters
+
a positive integer scalar
Details
The number of characters specified as a positive integer.
| Data types |
|
# sps — number of counts per symbol
+
a positive integer scalar
Details
The number of samples per symbol period (oversampling coefficient), set as a positive integer.
| Data types |
|
# shape — the shape of the raised cosine window
+
"sqrt" (by default) | "normal"
Details
The shape of the raised cosine window, defined as "normal" or "sqrt".
Output arguments
# b — FIR filter coefficients
+
vector string
Details
FIR filter coefficients with a "raised cosine" type characteristic, returned as a string vector.
| Data types |
|
Examples
Designing a filter with a "raised cosine" type characteristic using the square root method
Details
We will indicate the steepness of the decline equal to 0.25. Truncate the filter to 6 Let 's represent each character 4 by counting down. Let’s make sure that "sqrt" — this is the value of the argument shape by default.
import EngeeDSP.Functions: rcosdesign
h = rcosdesign(0.25, 6, 4)
mx = maximum(abs.(h - rcosdesign(0.25, 6, 4, "sqrt")))
0.0
n_max = 6 * 4 + 1
n = collect(1:n_max)
plot(n, impz(h),
seriestype = :stem,
marker = :circle,
title = "Impulse Responce",
xlabel = "n (samples)",
ylabel = "Amplitude",
legend = false)
Pulse characteristics of normal FPC and FPC using the square root method
Details
Let’s compare a normal filter with a characteristic of the "raised cosine" type (FPC) and FPC using the square root method. An ideal (infinite length) normal pulse generation FPC is equivalent to two ideal cascade FPCs. Thus, the impulse response of a normal FIR filter should resemble the impulse response of a filter using the square root method, convolved with itself.
Let’s create a normal FPC with a steep decline 0.25. Let’s point out that this filter covers 4 the po symbol 3 counting per symbol.
import EngeeDSP.Functions: rcosdesign
rf = 0.25
span = 4
sps = 3
h1 = rcosdesign(rf, span, sps, "normal");
n_max = span * sps + 1
n = collect(1:n_max)
plot(n, impz(h1),
seriestype = :stem,
marker = :circle,
title = "Impulse Responce",
xlabel = "n (samples)",
ylabel = "Amplitude",
legend = false)
A normal filter has zero intersections for integer values that are multiples of sps. Thus, it satisfies the Nyquist criterion for zero intersymbol interference. However, the filter using the square root method does not satisfy:
h2 = rcosdesign(rf, span, sps, "sqrt")
plot(n, impz(h2),
seriestype = :stem,
marker = :circle,
title = "Impulse Responce",
xlabel = "n (samples)",
ylabel = "Amplitude",
legend = false)
Let’s collapse the filter using the square root method with itself. Let’s truncate the impulse response from the maximum value so that its length coincides with h1. We normalize the characteristic using the maximum value. Let’s compare a collapsed filter using the square root method with a normal filter.
import EngeeDSP.Functions: conv
h3 = conv(h2, h2, "same")
y = [h1/maximum(abs.(h1)) h3/maximum(abs.(h3))]'
n_max = (span * sps + 1) * 2
n = collect(1:n_max)
plot!(n, y,
seriestype = :stem,
fillrange = 0,
marker = :circle,
xlabel = "Samples",
ylabel = "Normalized Amplitude",
label = "h2 * h2")
A collapsed filter does not match a normal filter due to its finite length. Increase the value span to obtain a more accurate match between the responses and a better match to the Nyquist criterion.
Passing a signal through a filter with a "raised cosine" type characteristic
Details
This example shows how to pass a signal through the FPC using the square root method.
Specify the filter parameters.
rolloff = 0.25 # Rolloff factor
span = 6 # Filter span in symbols
sps = 4 # Samples per symbol
Let’s generate the FPC coefficients using the square root method.
import EngeeDSP.Functions: rcosdesign
b = rcosdesign(rolloff, span, sps)
Create a vector of bipolar data.
d = 2 * randi([0 1], 100, 1) - 1
Let’s increase the sampling rate and filter out the data for pulse generation.
x = upfirdn(d, b, sps)
Add some noise.
r = x + randn(size(x)) * 0.01
Filter and lower the sampling rate of the received signal for consistent filtering.
y = upfirdn(r, b, 1, sps)