Thomas Tsou | 9ccd9f2 | 2013-08-21 13:59:52 -0400 | [diff] [blame] | 1 | % |
| 2 | % Laurent decomposition of GMSK signals |
| 3 | % Generates C0, C1, and C2 pulse shapes |
| 4 | % |
| 5 | % Pierre Laurent, "Exact and Approximate Construction of Digital Phase |
| 6 | % Modulations by Superposition of Amplitude Modulated Pulses", IEEE |
| 7 | % Transactions of Communications, Vol. 34, No. 2, Feb 1986. |
| 8 | % |
| 9 | % Author: Thomas Tsou <tom@tsou.cc> |
| 10 | % |
| 11 | |
| 12 | % Modulation parameters |
| 13 | oversamp = 16; |
| 14 | L = 3; |
| 15 | f = 270.83333e3; |
| 16 | T = 1/f; |
| 17 | h = 0.5; |
| 18 | BT = 0.30; |
| 19 | B = BT / T; |
| 20 | |
| 21 | % Generate sampling points for L symbol periods |
| 22 | t = -(L*T/2):T/oversamp:(L*T/2); |
| 23 | t = t(1:end-1) + (T/oversamp/2); |
| 24 | |
| 25 | % Generate Gaussian pulse |
| 26 | g = qfunc(2*pi*B*(t - T/2)/(log(2)^.5)) - qfunc(2*pi*B*(t + T/2)/(log(2)^.5)); |
| 27 | g = g / sum(g) * pi/2; |
| 28 | g = [0 g]; |
| 29 | |
| 30 | % Integrate phase |
| 31 | q = 0; |
| 32 | for i = 1:size(g,2); |
| 33 | q(i) = sum(g(1:i)); |
| 34 | end |
| 35 | |
| 36 | % Compute two sided "generalized phase pulse" function |
| 37 | s = 0; |
| 38 | for i = 1:size(g,2); |
| 39 | s(i) = sin(q(i)) / sin(pi*h); |
| 40 | end |
| 41 | for i = (size(g,2) + 1):(2 * size(g,2) - 1); |
| 42 | s(i) = sin(pi*h - q(i - (size(g,2) - 1))) / sin(pi*h); |
| 43 | end |
| 44 | |
| 45 | % Compute C0 pulse: valid for all L values |
| 46 | c0 = s(1:end-(oversamp*(L-1))); |
| 47 | for i = 1:L-1; |
| 48 | c0 = c0 .* s((1 + i*oversamp):end-(oversamp*(L - 1 - i))); |
| 49 | end |
| 50 | |
| 51 | % Compute C1 pulse: valid for L = 3 only! |
| 52 | % C1 = S0 * S4 * S2 |
| 53 | c1 = s(1:end-(oversamp*(4))); |
| 54 | c1 = c1 .* s((1 + 4*oversamp):end-(oversamp*(4 - 1 - 3))); |
| 55 | c1 = c1 .* s((1 + 2*oversamp):end-(oversamp*(4 - 1 - 1))); |
| 56 | |
| 57 | % Compute C2 pulse: valid for L = 3 only! |
| 58 | % C2 = S0 * S1 * S5 |
| 59 | c2 = s(1:end-(oversamp*(5))); |
| 60 | c2 = c2 .* s((1 + 1*oversamp):end-(oversamp*(5 - 1 - 0))); |
| 61 | c2 = c2 .* s((1 + 5*oversamp):end-(oversamp*(5 - 1 - 4))); |
| 62 | |
| 63 | % Plot C0, C1, C2 Laurent pulse series |
| 64 | figure(1); |
| 65 | hold off; |
| 66 | plot((0:size(c0,2)-1)/oversamp - 2,c0, 'b'); |
| 67 | hold on; |
| 68 | plot((0:size(c1,2)-1)/oversamp - 2,c1, 'r'); |
| 69 | plot((0:size(c2,2)-1)/oversamp - 2,c2, 'g'); |
| 70 | |
| 71 | % Generate OpenBTS pulse |
| 72 | numSamples = size(c0,2); |
| 73 | centerPoint = (numSamples - 1)/2; |
| 74 | i = ((0:numSamples) - centerPoint) / oversamp; |
| 75 | xP = .96*exp(-1.1380*i.^2 - 0.527*i.^4); |
| 76 | xP = xP / max(xP) * max(c0); |
| 77 | |
| 78 | % Plot C0 pulse compared to OpenBTS pulse |
| 79 | figure(2); |
| 80 | hold off; |
| 81 | plot((0:size(c0,2)-1)/oversamp, c0, 'b'); |
| 82 | hold on; |
| 83 | plot((0:size(xP,2)-1)/oversamp, xP, 'r'); |