|
| 1 | +""" |
| 2 | +Returns the Finite Impulse Response of a Raised Cosine (RC) filter. The filter is defined by its span (evaluated in number of symbol N), its Roll-Off factor and its oversampling factor. The span corresponds to the number of symbol affected by filter before and after the center point.\n |
| 3 | +Output is a Vector{Float64} array of size L= 2KN+1 \n |
| 4 | +SRRC definition is based on [1] \n |
| 5 | +[1] 3GPP TS 25.104 V6.8.0 (2004-12). http://www.3gpp.org/ftp/Specs/archive/25_series/25.104/25104-680.zip \n |
| 6 | + Syntax \n |
| 7 | + h = raisedCosine(N,beta,ovS) |
| 8 | +Input parameters \n |
| 9 | +- N : Symbol span (Int16) |
| 10 | +- beta : Roll-off factor (Float64) |
| 11 | +- ovS : Oversampling rate (Int16) |
| 12 | +""" |
| 13 | +function raisedCosine(N,beta,ovS) |
| 14 | + # --- Final size of filter |
| 15 | + nbTaps = 2 * N * ovS + 1; |
| 16 | + # --- Init output |
| 17 | + h = zeros(Float64,nbTaps); |
| 18 | + counter = 0; |
| 19 | + # --- Iterative SRRC definition |
| 20 | + for k = -N*ovS : 1 : N*ovS |
| 21 | + counter = counter + 1; |
| 22 | + if k == 0 |
| 23 | + ## First singular point at t=0 |
| 24 | + h[counter] = 1;#(1-beta) + 3*beta/pi; |
| 25 | + elseif abs(k) == ovS / (2*beta); |
| 26 | + ## Second possible singular point |
| 27 | + h[counter] = pi/4*sin(pi/(2beta))/(pi/(2beta)); |
| 28 | + else |
| 29 | + ## Classic SRRC formulation (see [1]) |
| 30 | + h[counter] = sin(pi*k/ovS)/(pi*k/ovS) * cos(pi*beta*k/ovS)/(1- 4beta^2*(k/ovS)^2); |
| 31 | + end |
| 32 | + end |
| 33 | + return h |
| 34 | +end |
| 35 | + |
| 36 | + |
| 37 | +""" |
| 38 | +Returns the Finite Impulse Response of a Square Root Raised Cosine (SRRC) filter. \n |
| 39 | +The filter is defined by its span (evaluated in number of symbol N), its Roll-Off factor and its oversampling factor. The span corresponds to the number of symbol affected by filter before and after the center point.\n |
| 40 | +Output is a Vector{Float64} array of size L= 2KN+1\n |
| 41 | +SRRC definition is based on [1]\n |
| 42 | +[1] 3GPP TS 25.104 V6.8.0 (2004-12). http://www.3gpp.org/ftp/ Specs/archive/25_series/25.104/25104-680.zip\n |
| 43 | +Syntax\n |
| 44 | +h = sqrtRaisedCosine(N,beta,ovS) \n |
| 45 | +Input parameters \n |
| 46 | +- N : Symbol span (Int16) |
| 47 | +- beta : Roll-off factor (Float64) |
| 48 | +- ovS : Oversampling rate (Int16) |
| 49 | +""" |
| 50 | +function sqrtRaisedCosine(N,beta,ovS) |
| 51 | + # --- Final size of filter |
| 52 | + nbTaps = 2 * N * ovS + 1; |
| 53 | + # --- Init output |
| 54 | + h = zeros(Float64,nbTaps); |
| 55 | + counter = 0; |
| 56 | + # --- Iterative SRRC definition |
| 57 | + for k = -N*ovS : 1 : N*ovS |
| 58 | + counter = counter + 1; |
| 59 | + if k == 0 |
| 60 | + ## First singular point at t=0 |
| 61 | + h[counter] = (1-beta) + 4*beta/pi; |
| 62 | + elseif abs(k) == ovS / (4*beta); |
| 63 | + ## Second possible singular point |
| 64 | + h[counter] = beta/sqrt(2)*( (1+2/pi)sin(pi/(4beta))+(1-2/pi)cos(pi/(4beta))); |
| 65 | + else |
| 66 | + ## Classic SRRC formulation (see [1]) |
| 67 | + h[counter] = ( sin(pi*k/ovS*(1-beta)) + 4beta*k/ovS*cos(pi*k/ovS*(1+beta))) / (pi*k/ovS*(1- (4beta*k/ovS)^2) ); |
| 68 | + end |
| 69 | + end |
| 70 | + # --- Max @ h[0] |
| 71 | + h = h ./ maximum(h) |
| 72 | + return h |
| 73 | +end |
0 commit comments