- TX: process data at symbol rate
- RX: removed kdown stuff (hardcode to 4), fixed redundant down sampling for base band processing git-svn-id: http://moon:8086/svn/matlab/trunk@37 801c6759-fa7c-4059-a304-17956f83a07c
This commit is contained in:
+9
-10
@@ -5,25 +5,22 @@ function [x] = ofdm_rx(filename, foff, knoise_dB, with_cir)
|
|||||||
% ofdm_rx('xv.wav', 0, -400, 0)
|
% ofdm_rx('xv.wav', 0, -400, 0)
|
||||||
% or ofdm_rx('yv.wav', 0, -400, 0)
|
% or ofdm_rx('yv.wav', 0, -400, 0)
|
||||||
|
|
||||||
|
close all;
|
||||||
|
|
||||||
drm_mode = 'B';
|
drm_mode = 'B';
|
||||||
drm_bw = '10k';
|
drm_bw = '10k';
|
||||||
|
|
||||||
[ofdm_drm_params, ofdm_spec_occ] = drm_params(drm_mode, drm_bw);
|
[ofdm_drm_params, ofdm_spec_occ] = drm_params(drm_mode, drm_bw);
|
||||||
|
|
||||||
close all;
|
|
||||||
pre_mix = 0;
|
pre_mix = 0;
|
||||||
Kdown = 4;
|
fs = 12000;
|
||||||
fs = 48000/Kdown;
|
N = 256;
|
||||||
fc = fs/4;
|
Ng = 64;
|
||||||
N = 1024/Kdown;
|
|
||||||
Ng = 256/Kdown;
|
|
||||||
[carrier_pilot, phi_pilot, mag_pilot] = getRefFreq(drm_mode);
|
[carrier_pilot, phi_pilot, mag_pilot] = getRefFreq(drm_mode);
|
||||||
[carrier_time, phi_time, mag_time] = getRefTime(drm_mode);
|
[carrier_time, phi_time, mag_time] = getRefTime(drm_mode);
|
||||||
|
|
||||||
h_cir = [0 0 .1 -.2 .5 .2 -.1 0 0 ];
|
h_cir = [0 0 .1 -.2 .5 .2 -.1 0 0 ];
|
||||||
|
|
||||||
close all;
|
|
||||||
|
|
||||||
% Generate signal
|
% Generate signal
|
||||||
[xwav fs_ nbits] = wavread(filename);
|
[xwav fs_ nbits] = wavread(filename);
|
||||||
|
|
||||||
@@ -37,10 +34,12 @@ elseif (ndim == 1)
|
|||||||
x = xwav.*exp(-j*(2*pi*(0.25-foff/fs_)*(0:len-1)'));
|
x = xwav.*exp(-j*(2*pi*(0.25-foff/fs_)*(0:len-1)'));
|
||||||
hlp = FIRCalcLowpass(12000/fs_, 33);
|
hlp = FIRCalcLowpass(12000/fs_, 33);
|
||||||
x = filter(hlp, 1, x);
|
x = filter(hlp, 1, x);
|
||||||
|
|
||||||
|
% Downsample
|
||||||
|
x = x(1:4:length(x));
|
||||||
else
|
else
|
||||||
error('Cannot read file!');
|
error('Cannot read file!');
|
||||||
end
|
end
|
||||||
x = x(1:Kdown:length(x));
|
|
||||||
|
|
||||||
if with_cir
|
if with_cir
|
||||||
x = filter(h_cir, 1, x);
|
x = filter(h_cir, 1, x);
|
||||||
@@ -53,7 +52,7 @@ wavwrite(xout,fs,nbits,'ofdm_rx.wav');
|
|||||||
x = x + sqrt(0.5)*10^(knoise_dB/20)*(randn(size(x)) + j*randn(size(x)));
|
x = x + sqrt(0.5)*10^(knoise_dB/20)*(randn(size(x)) + j*randn(size(x)));
|
||||||
|
|
||||||
|
|
||||||
K = fix((length(x)-Ng)/(N+Ng));
|
K = fix((length(x))/(N+Ng))-1;
|
||||||
|
|
||||||
% Timing coarse
|
% Timing coarse
|
||||||
cp_off_ = [];
|
cp_off_ = [];
|
||||||
|
|||||||
+8
-4
@@ -15,8 +15,8 @@ M_QAM = 64;
|
|||||||
RCWIN_ROLLOFF = 0.125;
|
RCWIN_ROLLOFF = 0.125;
|
||||||
|
|
||||||
% Params
|
% Params
|
||||||
fa = 48000;
|
fa = 12000;
|
||||||
T = 4/fa;
|
T = 1/fa;
|
||||||
|
|
||||||
[ofdm_params, ofdm_spec_occ] = drm_params(mode, bandwidth);
|
[ofdm_params, ofdm_spec_occ] = drm_params(mode, bandwidth);
|
||||||
|
|
||||||
@@ -107,12 +107,16 @@ grid;
|
|||||||
plot(wng); grid;
|
plot(wng); grid;
|
||||||
|
|
||||||
% Modulate on carrier
|
% Modulate on carrier
|
||||||
yc = exp(j*2*pi.*(0:length(xv)-1)*0.25) .* xv;
|
xup = upsample(xv, 4);
|
||||||
|
hlp = FIRCalcLowpass(0.25, 129);
|
||||||
|
xup = filter(hlp, 1, xup);
|
||||||
|
|
||||||
|
yc = exp(j*2*pi.*(0:length(xup)-1)*0.25) .* xup;
|
||||||
yv = real(yc) + imag(yc);
|
yv = real(yc) + imag(yc);
|
||||||
|
|
||||||
xv = conj(xv')./abs(max(xv));
|
xv = conj(xv')./abs(max(xv));
|
||||||
yv = yv'./max(yv);
|
yv = yv'./max(yv);
|
||||||
|
|
||||||
wavwrite(0.9*yv,fa,16,'yv.wav')
|
wavwrite(0.9*yv,4*fa,16,'yv.wav')
|
||||||
wavwrite(0.9*[real(xv) imag(xv)],fa,16,'xv.wav')
|
wavwrite(0.9*[real(xv) imag(xv)],fa,16,'xv.wav')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user