- fixed jitter in H estimation

- consider power boost in params
- RX: cleaned up
- TX: cleaned up


git-svn-id: http://moon:8086/svn/matlab/trunk@44 801c6759-fa7c-4059-a304-17956f83a07c
This commit is contained in:
2015-04-30 06:21:22 +00:00
parent 584d16e3bf
commit c5c6c37848
5 changed files with 106 additions and 114 deletions
+53 -53
View File
@@ -47,64 +47,64 @@ x_suffix = zeros(2, Ng);
ofdm_spec_occ.kmin
ofdm_spec_occ.kmax
sym_count = 0;
for k=1:N_frames
for sym_count=0:ofdm_params.nspf-1,
X = zeros(N,1);
% Data
if WITH_DATA == 1
data_i = c2i(N, ofdm_spec_occ.kmin:1:ofdm_spec_occ.kmax);
sym = round(M_QAM*rand(1, length(data_i))+0.5);
X(data_i) = qlut(sym);
end;
X = zeros(N,1);
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(j*2*pi*ref_p/1024));
end;
% Data
if WITH_DATA == 1
data_i = c2i(N, ofdm_spec_occ.kmin:1:ofdm_spec_occ.kmax);
sym = round(M_QAM*rand(1, length(data_i))+0.5);
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);
bins = c2i(N, ref_c);
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(j*2*pi*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(j*2*pi*ref_p/1024));
end;
X(c2i(N, 0)) = 0;
% Modulate
xu = k_fft*ifft(X, N).';
if WITH_RCWIN == 1
x_prefix(1,:) = xu(N-Ng+1:N);
x_suffix(1,:) = xu(1:Ng);
x_pw = x_suffix(2,:) .* (1-wng) + x_prefix(1,:) .* wng;
xs = [x_pw xu];
x_prefix(2,:) = x_prefix(1,:);
x_suffix(2,:) = x_suffix(1,:);
else
xs = [xu(N-Ng+1:N) xu];
end;
xv = [xv xs(1:Ng+N)];
if (DO_PLOT == 1)
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(j*2*pi*ref_p/1024));
end;
X(c2i(N, 0)) = 0;
% Modulate
xu = k_fft*ifft(X, N).';
if WITH_RCWIN == 1
x_prefix(1,:) = xu(N-Ng+1:N);
x_suffix(1,:) = xu(1:Ng);
x_pw = x_suffix(2,:) .* (1-wng) + x_prefix(1,:) .* wng;
xs = [x_pw xu];
x_prefix(2,:) = x_prefix(1,:);
x_suffix(2,:) = x_suffix(1,:);
else
xs = [xu(N-Ng+1:N) xu];
end;
xv = [xv xs(1:Ng+N)];
if (DO_PLOT == 1)
% 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;
Xs = fftshift(X);
subplot(2, 1, 1)
plot(0:N-1, abs(Xs(1:N)), '-*'); grid; axis([0 N-1 0 3.0]);
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
sym_count = mod(sym_count+1, ofdm_params.nspf);
end;
hold off;
grid;
@@ -119,7 +119,7 @@ xup = filter(hlp, 1, xup);
yc = exp(j*2*pi.*(0:length(xup)-1)*0.25) .* xup;
yv = real(yc) + imag(yc);
xv = conj(xv')./abs(max(xv));
xv = xv.' ./abs(max(xv));
yv = yv'./max(yv);
wavwrite(0.9*yv,4*fa,16,'yv.wav')