chirp test
Contents
generate chirp signal
f1 = 800;
f2 = 2000;
nbits = 15;
N = 2^15;
t = (0:N-1)/N;
y = sin(2*pi*(f1+(f2-f1)*t).*t);
n = 0.01*N;
idx = 1:n;
subplot(2,1,1);
plot(t(idx),y(idx));
subplot(2,1,2);
idx = N - idx;
t0 = t(min(idx));
plot(t(idx)-t0,y(idx));
generate FT of signal
close all;
fourier_xform(y,t,2000);
[fy f] = fourier_xform(y,t);
fprintf('fmax = %g kHz\n',max(f)*1e-3);
fmax = 16.383 kHz
filter design
[z p k] = buttap(4);
[bp ap] = zp2tf(z,p,k);
fc = 1200;
bw = 100;
[b a] = lp2bp(bp,ap,2*pi*fc,2*pi*bw);
apply filter to FT of signal
h = freqs(b,a,2*pi*f);
fyf = fy.*h;
idx = find(f>f1 & f<f2);
freqs_plot(h(idx),f(idx),'plot');
figure
plot(f(idx),abs(h(idx)));
inverse Fourier transform
close all;
[x tn] = inv_fourier_xform(fyf,f);
plot(f1+ (f2-f1)*t,x);
xlabel('frequency (Hz)');