- added
git-svn-id: http://moon:8086/svn/matlab/trunk@157 801c6759-fa7c-4059-a304-17956f83a07c
This commit is contained in:
Executable
+30
@@ -0,0 +1,30 @@
|
||||
function agc_eval()
|
||||
%
|
||||
% Super peak-based AGC
|
||||
|
||||
N = 2000;
|
||||
k_noise = 1E-3;
|
||||
|
||||
t = (0:N-1)/N;
|
||||
x = sin(100*pi*t) + k_noise*randn(1, N);
|
||||
w = 1;
|
||||
K = 2;
|
||||
mu = 0.01;
|
||||
|
||||
max1 = maxlist_filterstate(1000, 1E12, 1);
|
||||
|
||||
for n=1:N,
|
||||
d1 = w*x(n);
|
||||
[d2, max1] = maxlist_filter(d1, max1);
|
||||
e = K - d2;
|
||||
w = w + mu*e*abs(x(n));
|
||||
d1_(n) = d1;
|
||||
e_(n) = e;
|
||||
end;
|
||||
|
||||
subplot(3, 1, 1)
|
||||
plot(t, x); grid; legend('x');
|
||||
subplot(3, 1, 2)
|
||||
plot(t, d1_); grid; legend('d_{1}');
|
||||
subplot(3, 1, 3)
|
||||
plot(t, 20*log10(abs(e_)+1e-12)); legend('20*log10(error)'); grid;
|
||||
Reference in New Issue
Block a user