- fixed getRefTime.m
- fixed getRefGain.m - minor changes to RX/TX git-svn-id: http://moon:8086/svn/matlab/trunk@43 801c6759-fa7c-4059-a304-17956f83a07c
This commit is contained in:
@@ -6,7 +6,7 @@ y = ofdm_params.y;
|
||||
|
||||
s = mod(s, ofdm_params.nspf);
|
||||
|
||||
k = k0 + x*mod(s, y) + 2*y*(spec_occ.kmin:1:spec_occ.kmax);
|
||||
k = k0 + x*mod(s, y) + x*y*(spec_occ.kmin:1:spec_occ.kmax);
|
||||
k(find(k > spec_occ.kmax)) = [];
|
||||
k(find(k < spec_occ.kmin)) = [];
|
||||
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
function [ref_c ref_p ref_a] = getRefTime(drmMode)
|
||||
|
||||
ref_B_c = [14 18 20 24 26 32 36 42 44 49 50 54 56 62 66 68];
|
||||
ref_B_p = [304 108 620 192 704 44 432 588 844 651 651 460 460 944 940 428];
|
||||
ref_B_a = sqrt(2)*ones(1,16);
|
||||
|
||||
switch drmMode
|
||||
case 'A'
|
||||
ref_c = [];
|
||||
@@ -12,9 +8,9 @@ switch drmMode
|
||||
error ('Implement Mode A!');
|
||||
|
||||
case 'B'
|
||||
ref_c = ref_B_c;
|
||||
ref_p = ref_B_p;
|
||||
ref_a = ref_B_a;
|
||||
ref_c = [14 16 18 20 24 26 32 36 42 44 48 49 50 54 56 62 64 66 68];
|
||||
ref_p = [304 331 108 620 192 704 44 432 588 844 651 651 651 460 460 944 555 940 428];
|
||||
ref_a = sqrt(2)*ones(1,length(ref_c));
|
||||
|
||||
case 'C'
|
||||
ref_c = [];
|
||||
|
||||
+2
-2
@@ -259,9 +259,9 @@ for k=start:length(Z_)
|
||||
sym_out(:, kk) = ZZ ./ H;
|
||||
if 1
|
||||
subplot(2, 1, 1)
|
||||
plot(abs(H)); grid; title('abs(H)');
|
||||
plot(0:length(H)-1, abs(H)); grid; title('abs(H)'); axis([0 length(H)-1 0 15+0*max(abs(H))]);
|
||||
subplot(2, 1, 2)
|
||||
plot(angle(H)); grid; title('phi(H)');
|
||||
plot(0:length(H)-1, angle(H)); grid; title('phi(H)'); axis([0 length(H)-1 -4 4]);
|
||||
else
|
||||
hold on;
|
||||
plot(sym_out(:, kk), '+');
|
||||
|
||||
+19
-15
@@ -1,9 +1,9 @@
|
||||
% function ofdm_tx(N_frames)
|
||||
function [yv xv] = ofdm_tx(mode, bandwidth, N_frames, withData)
|
||||
function [yv xv] = ofdm_tx(mode, bandwidth, N_frames, withData, plot_speed)
|
||||
|
||||
close all;
|
||||
|
||||
DO_PLOT = 0;
|
||||
DO_PLOT = (plot_speed > 0);
|
||||
WITH_RCWIN = 1;
|
||||
WITH_FREQ_REF = 1;
|
||||
WITH_TIME_REF = 1;
|
||||
@@ -49,7 +49,6 @@ ofdm_spec_occ.kmin
|
||||
ofdm_spec_occ.kmax
|
||||
for k=1:N_frames
|
||||
for sym_count=0:ofdm_params.nspf-1,
|
||||
|
||||
X = zeros(N,1);
|
||||
|
||||
% Data
|
||||
@@ -59,27 +58,28 @@ for k=1:N_frames
|
||||
X(data_i) = qlut(sym);
|
||||
end;
|
||||
|
||||
if WITH_GAIN_REF == 1
|
||||
[ref_c ref_p ref_a] = getRefGain(ofdm_params, ofdm_spec_occ, sym_count);
|
||||
X(c2i(N, ref_c)) = ref_a.*(exp(2*pi*i*ref_p/1024));
|
||||
end;
|
||||
|
||||
if (sym_count==0) & (WITH_TIME_REF == 1)
|
||||
[ref_c ref_p ref_a] = getRefTime(ofdm_params.mode);
|
||||
bins = c2i(N, ref_c);
|
||||
X(bins) = ref_a.*(exp(2*pi*i*ref_p/1024));
|
||||
X(bins) = ref_a.*(exp(j*2*pi*ref_p/1024));
|
||||
end;
|
||||
|
||||
if WITH_GAIN_REF == 1
|
||||
[ref_c ref_p ref_a] = getRefGain(ofdm_params, ofdm_spec_occ, sym_count);
|
||||
bins = c2i(N, ref_c);
|
||||
X(bins) = ref_a.*(exp(j*2*pi*ref_p/1024));
|
||||
end;
|
||||
|
||||
if WITH_FREQ_REF == 1
|
||||
[ref_c ref_p ref_a] = getRefFreq(ofdm_params.mode);
|
||||
bins = c2i(N, ref_c);
|
||||
X(bins) = ref_a.*(exp(2*pi*i*ref_p/1024));
|
||||
X(bins) = ref_a.*(exp(j*2*pi*ref_p/1024));
|
||||
end;
|
||||
|
||||
|
||||
X(c2i(N, 0)) = 0;
|
||||
|
||||
% Modulate
|
||||
xu = conj(k_fft*ifft(X, N)');
|
||||
xu = k_fft*ifft(X, N).';
|
||||
if WITH_RCWIN == 1
|
||||
x_prefix(1,:) = xu(N-Ng+1:N);
|
||||
x_suffix(1,:) = xu(1:Ng);
|
||||
@@ -96,9 +96,13 @@ for k=1:N_frames
|
||||
xv = [xv xs(1:Ng+N)];
|
||||
|
||||
if (DO_PLOT == 1)
|
||||
Xs = fftshift(fft(xs(Ng+1:Ng+N), N)/k_fft);
|
||||
plot(0:N-1, abs(Xs(1:N)), '-*'); grid;
|
||||
pause(0.01);
|
||||
% Xs = fftshift(fft(xs(Ng+1:Ng+N), N)/k_fft);
|
||||
Xs = fftshift(X);
|
||||
subplot(2, 1, 1)
|
||||
plot(0:N-1, abs(Xs(1:N)), '-*'); grid; axis([0 N-1 0 2]);
|
||||
subplot(2, 1, 2)
|
||||
plot(0:N-1, angle(Xs(1:N)), '-*'); grid; axis([0 N-1 -2*pi 2*pi]);
|
||||
pause(plot_speed);
|
||||
end
|
||||
end;
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user