clear all;
fs = 44100;
N = 5; type=3;
L = floor(N/2);
switch type
case 0
G0 = 0; G = 18; GB = 15; Gs = 0.01;
case 1
G0 = 0; G = 18; GB = 17.99;
case 2
G0 = 0; G = 18; GB = 0.01;
case 3
G0 = 0; G = 18; GB = 17.99; Gs = 0.01;
end
Na = 1000; Nb = 3000; Nc = 4000;
scale = 1;
fa = scale * 44.1; Dfa = scale * 22.05;
fb = scale * 441; Dfb = scale * 220.5;
for n=1:Nc+1,
if n<=Na+1,
f0(n) = fa;
Df(n) = Dfa;
elseif n<=Nb+1,
f0(n) = fa + (fb-fa)/(Nb-Na) * (n-Na-1);
Df(n) = Dfa + (Dfb-Dfa)/(Nb-Na) * (n-Na-1);
else
f0(n) = fb;
Df(n) = Dfb;
end
end
w0 = 2*pi*f0/fs; Dw = 2*pi*Df/fs; c0 = cos(w0); s0 = sqrt(1-c0.^2);
U = zeros(L+1,4); U1 = zeros(L+1,4);
V = zeros(L+1,4); V1 = zeros(L+1,4);
W = zeros(L+1,4); W1 = zeros(L+1,4);
S = zeros(2,2,L+1); S1 = zeros(2,2,L+1);
Z = zeros(L+1,8); Z1 = zeros(L+1,8);
seed = 2005; rand('state',seed);
x = rand(1,Nc+1);
x1 = 0.5 * ones(1,Nc+1);
for n=1:Nc+1,
switch type
case {0,1,2}
[Beq,Aeq,Bhat,Ahat] = hpeq(N, G0, G, GB, w0(n), Dw(n), type);
case 3
[Beq,Aeq,Bhat,Ahat] = hpeq(N, G0, G, GB, w0(n), Dw(n), 3, Gs);
end
[ycn(n),U] = df2filt(Bhat,Ahat,w0(n),x(n),U);
[ycn1(n),U1] = df2filt(Bhat,Ahat,w0(n),x1(n),U1);
[ytr(n),V] = transpfilt(Bhat,Ahat,w0(n),x(n),V);
[ytr1(n),V1] = transpfilt(Bhat,Ahat,w0(n),x1(n),V1);
[gamma,d] = dir2latt(Bhat,Ahat);
[ynl(n),W] = nlattfilt(gamma,d,w0(n),x(n),W);
[ynl1(n),W1] = nlattfilt(gamma,d,w0(n),x1(n),W1);
[A,B,C,D] = dir2state(Bhat,Ahat);
[yst(n),S] = statefilt(A,B,C,D,w0(n),x(n),S);
[yst1(n),S1] = statefilt(A,B,C,D,w0(n),x1(n),S1);
[gamma,dec] = dir2decoup(Bhat,Ahat);
[yde(n),Z] = decoupfilt(gamma,dec,w0(n),x(n),Z);
[yde1(n),Z1] = decoupfilt(gamma,dec,w0(n),x1(n),Z1);
end
t = (0:Nc);
set(0,'DefaultAxesFontSize',15);
figure;
subplot(2,1,1);
plot(t,ycn);
grid;
ylim([-2.7,2.7]);
title('Canonical');
xlabel('time samples');
print -deps fig15a.eps
figure;
subplot(2,1,1);
plot(t,ytr);
grid;
ylim([-2.7,2.7]);
title('Transposed');
xlabel('time samples');
print -deps fig15b.eps
figure;
subplot(2,1,1);
plot(t,ynl);
grid;
ylim([-2.7,2.7]);
title('Normalized Lattice');
xlabel('time samples');
print -deps fig15c.eps
figure;
subplot(2,1,1);
plot(t,yst);
grid;
ylim([-2.7,2.7]);
title('State Space');
xlabel('time samples');
print -deps fig15d.eps
figure;
subplot(2,1,1);
plot(t,yde);
grid;
ylim([-2.7,2.7]);
title('Decoupled');
xlabel('time samples');
print -deps fig15e.eps
figure;
subplot(2,1,1);
plot(t,ycn1);
grid;
ylim([-2.7,2.7]);
title('Canonical');
xlabel('time samples');
print -deps fig15a1.eps
figure;
subplot(2,1,1);
plot(t,ytr1);
grid;
ylim([-2.7,2.7]);
title('Transposed');
xlabel('time samples');
print -deps fig15b1.eps
figure;
subplot(2,1,1);
plot(t,ynl1);
grid;
ylim([-2.7,2.7]);
title('Normalized Lattice');
xlabel('time samples');
print -deps fig15c1.eps
figure;
subplot(2,1,1);
plot(t,yst1);
grid;
ylim([-2.7,2.7]);
title('State Space');
xlabel('time samples');
print -deps fig15d1.eps
figure;
subplot(2,1,1);
plot(t,yde1);
grid;
ylim([-2.7,2.7]);
title('Decoupled');
xlabel('time samples');
print -deps fig15e1.eps