git-svn-id: http://moon:8086/svn/matlab/trunk@6 801c6759-fa7c-4059-a304-17956f83a07c
24 lines
569 B
Matlab
24 lines
569 B
Matlab
function ofdm_rx(x)
|
|
|
|
close all;
|
|
|
|
CP_SIZE = 256;
|
|
FFT_SIZE = 1024;
|
|
fa = 48000;
|
|
|
|
k_fft = 2*sqrt(FFT_SIZE);
|
|
|
|
figure;
|
|
Ns = (CP_SIZE + FFT_SIZE);
|
|
Nf = length(x)/Ns;
|
|
for k=1:Nf
|
|
Xs = fft(x((k-1)*Ns+CP_SIZE+1:(k-1)*Ns+CP_SIZE+FFT_SIZE), FFT_SIZE)/k_fft;
|
|
mag = abs(Xs(1:FFT_SIZE/8));
|
|
phase = angle(Xs(1:FFT_SIZE/8));
|
|
subplot(2, 1, 1)
|
|
plot(fa*(0:lge(mag)-1)/FFT_SIZE, mag, '-*'); grid;
|
|
subplot(2, 1, 2)
|
|
plot(fa*(0:lge(phase)-1)/FFT_SIZE, phase, '-*'); axis([0, fa*(lge(phase)-1)/FFT_SIZE, -pi, +pi]);grid;
|
|
pause (0.001);
|
|
end
|