📄 c_anablock.m
字号:
function y=C_anablock(x,h1,h2)% C_anablock Analysis block in a FIR two channel filterbank
%
% y=C_anablock(x,h1,h2);% ----------------------------------------------% Arguments:
% x - the signal, a column vector (or a matrix of column vectors)
% each column is filtered independently of each other
% [N,L]=size(x); and we should have mod(N,2)==0
% h1 - the FIR filter for the upper branch (low pass)
% h2 - the FIR filter for the lower branch (high pass)
% y - the subbands, size(y)=[N/2,2*L], where odd columns correspond to
% the upper branch, and even columns to the lower branch
% ----------------------------------------------
% Note that we assume circular expansion of the signal x
%----------------------------------------------------------------------
% Copyright (c) 1999. 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 20.08.1999 KS: Function made
% Ver. 1.1 02.12.2002 KS: moved from ..\Frames to ..\FrameTools\%----------------------------------------------------------------------
Mfile='C_anablock';
Circular=1; % make circular expansion of signal (results)
if (nargin ~= 3)
error([Mfile,': wrong number of arguments, see help.']);
end
[N,L]=size(x);
if (mod(N,2))
error([Mfile,': length of signal(s) is not a factor of two, see help.']);
end
N1=length(h1);
N2=length(h2);
% make sure filters have odd length
if mod(N1-1,2); h1=[h1(:);0]; N1=N1+1; end;
if mod(N2-1,2); h2=[h2(:);0]; N2=N2+1; end;
N3=max([N1,N2]);
y=zeros((N+N3-1)/2,2*L);
for l=1:L
% upper branch
u=conv(x(:,l),h1);
u=reshape(u,2,(N+N1-1)/2); % N1 is odd and N is even
y(1:((N+N1-1)/2),2*l-1)=u(2,:)';
% lower branch
u=conv(x(:,l),h2);
u=reshape(u,2,(N+N2-1)/2); % N2 is odd and N is even
y(1:((N+N2-1)/2),2*l)=u(2,:)';
end
if Circular
first=1:((N3-1)/2);
middle=((N3+1)/2):(N/2);
last=(N/2+1):((N+N3-1)/2);
y=[y(first,:)+y(last,:);y(middle,:)];
end
return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -