- initial version

git-svn-id: http://moon:8086/svn/matlab/trunk@19 801c6759-fa7c-4059-a304-17956f83a07c
This commit is contained in:
2015-04-05 09:00:44 +00:00
parent 7b2e93a4f4
commit e0bb654e70
+32
View File
@@ -0,0 +1,32 @@
function fdet_wav(filename, p)
close all;
fs = 48000;
N = 1024;
omega_min = p(1)/fs;
omega_max = p(2)/fs;
omega_step = p(3)/fs;
% Generate signal
[xwav fs nbits] = wavread(filename);
x = xwav(:, 1) + j*xwav(:, 2);
[omega, err, dmod, omega_coarse, omega_est] = fdet(x, N, omega_min, omega_step, omega_max);
f_coarse = omega_coarse*fs
f_est = omega_est*fs
close all;
subplot(4,1,1)
plot(1:lge(omega), real(dmod)/N, 1:lge(omega), imag(dmod)/N, 1:lge(omega), abs(dmod)/N); grid; legend('Re', 'Im', 'abs()');
subplot(4,1,2)
plot(1:lge(omega), err, '-'); grid; legend('error');
subplot(4,1,3)
plot(1:lge(omega), omega*fs); grid; legend('f');
subplot(4,1,4)
plot(1:lge(omega), angle(dmod), '-*', 1:lge(omega), diff(angle([0 dmod])), 'r-*'); grid; legend('phi', 'dphi');