你如何得到LTFAT中小波变换的“近似”和“细节”?

时间:2014-12-04 09:12:14

标签: matlab octave wavelet

我正在尝试开始使用Matlab / Octave的LTFAT工具箱?

很容易得到信号的小波和比例系数

[c,info] = fwt(signal,'sym8',8);

但我不知道如何获得相应的“近似值”和“细节”...我猜他们可以在你运行时获得

plotwavelets(c,info)

绘制它们(“子带”d1,d2,...,a5)

有谁熟悉这个工具箱?

更新:我在LTFAT邮件列表中询问他们是否帮助了我(感谢Nicki Holighaus)。万一有人绊倒了......

LTFAT没有特定的函数从相应的系数产生近似值和细节,但可以使用逆DWT轻松计算:您只需重建信号,将所有内容设置为零,但相应细节/近似值的系数除外你想要获得。这段代码对我有用

% the DWT coefficients are split according to the different levels
cellCoeffs = wavpack2cell(c,info.Lc);

% number of "bands", including the approximations and all the details
nBands = length(info.Lc);

% a cell array containing the coefficients of the DWT (in the form required by "wavcell2pack") for the reconstruction
emptyCellCoeffs = cell(nBands,1);

% the cell corresponding to each "band" is set to a vector of zeros of the appropriate length
for i=1:nBands
    emptyCellCoeffs{i} = zeros(info.Lc(i),1);
end

% it will contain the aproximations and details
res = zeros(nBands,length(signal));

for i=1:nBands
    % a copy of the coefficients for the reconstruction with everything set to zero...
    aux = emptyCellCoeffs;

    % ...except the coefficients for the corresponding level
    aux{i} = cellCoeffs{i};

    % inverse DWT after turning the cell representation back into a vector
    res(i,:) = ifwt(wavcell2pack(aux),info);
end

error = sum(sum(res,1) - signal')

你可能在效率方面做得更好......但我认为这很容易理解。

干杯!

0 个答案:

没有答案