⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c_synblock.m

📁 Sparse Signal Representation using Overlapping Frames (matlab toolbox)
💻 M
字号:
function x=C_synblock(y,g1,g2)% C_synblock  Synthesis block in a FIR two channel filterbank 
%
% x=C_synblock(y,g1,g2);% ----------------------------------------------% Arguments:
%   y    - the subbands, odd columns correspond to the upper branch (low pass)
%          and even columns correspond to the lower branch (high pass)
%          We should have [N,L]=size(y) and L an even number
%   x    - the resulting signal, two and two columns of y are filtered to 
%          give one column of x, size(x)=[2*N,L/2]
%   g1   - the FIR filter for the upper branch (low pass)
%   g2   - the FIR filter for the lower branch (high pass)
% ----------------------------------------------
% Note that we assume circular expansion of the sunbands y (and 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_synblock';
Circular=1;       % make circular expansion of signal (results)
% compensate for system delay
Delay=floor((length(g1)+length(g2)-2)/2);  

if (nargin ~= 3)
   error([Mfile,': wrong number of arguments, see help.']);
end

[N,L]=size(y);
if (mod(L,2)) 
   error([Mfile,': there are not an even number of subbands, see help.']);
end
N1=length(g1);
N2=length(g2);
% make sure filters have odd length
if mod(N1-1,2); g1=[g1(:);0]; N1=N1+1; end;
if mod(N2-1,2); g2=[g2(:);0]; N2=N2+1; end;
N3=max([N1,N2]);
x=zeros(2*N+N3-1,L/2);

for l=2:2:L
   % upper branch
   u=reshape([zeros(1,N);y(:,l-1)'],2*N,1);
   x(1:(2*N+N1-1),l/2)=conv(u,g1);
   u=reshape([zeros(1,N);y(:,l)'],2*N,1);
   x(1:(2*N+N2-1),l/2)=x(1:(2*N+N2-1),l/2)+conv(u,g2);
end

if Circular
   first=1:(N3-1);
   middle=N3:(2*N);
   last=(2*N+1):(2*N+N3-1);
   x=[x(first,:)+x(last,:);x(middle,:)];
   if Delay
      first=1:Delay;
      last=(Delay+1):(2*N);
      x=[x(last,:);x(first,:)];
   end
end


return;
   

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -