1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| load IQdata1.txt;
Fc = 13650; % center frequency as set in the sample application
Ro = 500; % output sample rate in kS/s as set in the StreamModeSample application
x = IQdata1(:,1) + i*IQdata1(:,2); %% transform IQ in a complex vector
x = x/(2^31); %% normalize to unit
samples = length(x);
n = 1:samples;
f = (n/samples-0.5)*Ro+Fc;
temps=n*(1/(Ro*1e3));
kwin = kaiser(samples, 13); %% generates a Kaiser window function
kwinsum = sum(kwin);
kwin = kwin/kwinsum; %% normalize window
xwin = kwin.*x; %% window the input data
xfft = fft(xwin); %% computes the fft
xmag = fftshift(20*log10(abs(xfft*2))); %% compute the magnitude in dBFs
subplot(2,1,1);
plot(f,xmag); %% show the input signal spectrum
axis ([ f(1) f(samples) -160 0]);
grid;
title('StreamModeSample');
xlabel('F (kHz)');
ylabel('dBFs');
d=fdesign.bandpass('N,Fp1,Fp2,Ap',20,0.01,0.02,2);
Hd = design(d);
x_filtre=filter(Hd,x);
xmag_filtre = fftshift(20*log10(abs(fft(x_filtre*2))));
subplot(2,1,2);
plot(f,xmag_filtre);grid on; |
Partager