?? c_syn.m
字號(hào):
function X = C_syn(Y,a0,a1)
% C_syn The synthesis part of an IIR filter bank based on allpass filters
% Two and two columns of Y are filtered independently of the other columns
% to give one column in X.
% Block diagram, x is a column of X. y0 and y1 are columns of Y.
%
% y0 v0 +----------+ even x
% ----------->(+)------>| A0(z^-1) |-----------+
% \ / +----------+ | x
% x +--->--->
% y1 / \ v1 +----------+ | 0.5
% -------->-->(+)------>| A1(z^-1) |-----------+
% -1 +----------+ odd x
%
% X = C_syn(Y,a0,a1);
% ---------------------------------------------------------------------------% arguments:
% Y the subband signal to be filtered, number of columns should be even.
% a0,a1 the values of a0 and a1 used in the IIR filterbank.
% ---------------------------------------------------------------------------
%----------------------------------------------------------------------
% Copyright (c) 1998. Karl Skretting. All rights reserved.
% Hogskolen in Stavanger (Stavanger University), Signal Processing Group
% Mail: karl.skretting@tn.his.no Homepage: http://www.ux.his.no/~karlsk/
%
% HISTORY:
% Ver. 1.0 27.03.1998 Karl Skretting, used in Master thesis 1998, HIS:
% "Kompresjon av seismiske data"
% Ver. 1.1 20.07.2000 KS: added optional arguments a0, a1
% Ver. 1.2 02.12.2002 KS: moved from ..\Frames to ..\FrameTools
%----------------------------------------------------------------------
Mfile='C_syn';
% check input and output arguments, and assign values to arguments
if (nargin < 1);
error([Mfile,': function must have one input argument, see help.']);
end
if (nargin < 3)
% the default values
a0=0.1576056086;
a1=0.6148404766;
end
% periodic extension of the signal in the ends by "ekstra" samples
ekstra=50;
N2=size(Y,1);
kol=size(Y,2);
if (rem(kol,2) ~= 0)
error([Mfile,': Y should have an even number of columns, see help.']);
end
N=N2*2;
X=zeros(N,kol/2);
for kol=1:2:size(Y,2)
y0=Y(:,kol);
y1=Y(:,kol+1);
v0=y0+y1;
v1=y0-y1;
x=zeros(N,1);
% filtering backwards using A0
i=mod(ekstra,N2);
if (i==0); i=N2; end
temp=0;
last=0; % last v
for k=1:ekstra
temp=a0*(v0(i)-temp)+last;
last=v0(i);
i=i-1; if (i<1); i=i+N2; end;
end
if (i~=N2)
error([Mfile,': logical error, (v0), i ~= N2.']);
end
for k=N:-2:2
temp=a0*(v0(i)-temp)+last;
last=v0(i);
i=i-1; % if (i<1); i=i+N2; end;
x(k)=temp;
end
% filtering backwards using A1
i=mod(ekstra,N2);
if (i==0); i=N2; end
temp=0;
last=0; % last v
for k=1:ekstra
temp=a1*(v1(i)-temp)+last;
last=v1(i);
i=i-1; if (i<1); i=i+N2; end;
end
if (i~=N2)
error([Mfile,': logical error, (v1), i ~= N2.']);
end
for k=(N-1):-2:1
temp=a1*(v1(i)-temp)+last;
last=v1(i);
i=i-1; % if (i<1); i=i+N2; end;
x(k)=temp;
end
X(:,(kol+1)/2)=0.5*x;
end
return
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -