📄 wavelet2.m
字号:
function y=wavelet2(x,Nstgs,Nwts,window)
% y=wavelet2(x,Nstgs,Nwts,window)
%
% Wavelet transform 2: octal bands using QMF stages.
%
% Inputs:
% x(1:K) =input signal (converted to a vector).
% K should be a multiple of 2^Nstgs, or x will be truncated.
% Nstgs =number of stages in the decomposition.
% (This function produces Nstgs+1 bands in output vector y.)
% Nwts =number of weights in FIR filters. Should be odd.
% window =1 (boxcar), 2 (tapered), 3(tent) 4 (hanning),
% 5 (hamming), 6(blackman), or 7(kaiser)
% (In the last case windo is a vector=[7,beta],
% with beta in range [4,9].)
% Output:
% y =output vector consisting of low to high bands.
% Refer to text, fig. 10.26. Suppose length(x)=K=64 and Nstgs=3.
% Then y(1:8)=xLLL, y(9:16)=xLLH, y(17:32)=xLH, and y(33:64)=xH.
%
% See also: iwavelet2, wavelet1, iwavelet1, qmf, iqmf
x=col_vec(x); %x must be a vector
N=2*floor(Nwts/2)+1; %filter size must be odd
M=fix(length(x)/2^Nstgs); %M =length of shortest output sig.
if M<4, %check if x is large enough
error('Data vector is too short.')
end
K=M*2^Nstgs; %K =length(input)=length(y)
L=K; %L = stage signal length
y=x(1:K); %y is initially x(1:K)
for stg=1:Nstgs, %for stages 1,2,...,Nstgs
y(1:L)=qmf(y(1:L),Nwts,window); %y=[low,high] bands
L=L/2; %next time take the low band
end %finally, y(1:L) =xLLLL...L
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -