フィルターのクリア

Following code, when run shows "Error using wthcoef (line 58). Invalid level value". What do I do to correct it?

3 ビュー (過去 30 日間)
Sayan Mitra
Sayan Mitra 2021 年 6 月 30 日
編集済み: Ayush 2024 年 1 月 2 日
[c,l] = wavedec(yNoisy,7,'db4');
approx = appcoef(c,l,'db4');
[cd1,cd2,cd3,cd4,cd5,cd6,cd7] = detcoef(c,l,[1 2 3 4 5 6 7]);
thr_approx = thselect(approx,'rigrsure');
thr_cd7 = thselect(cd7,'rigrsure');
thr_cd6 = thselect(cd6,'rigrsure');
thr_cd5 = thselect(cd5,'rigrsure');
thr_cd4 = thselect(cd4,'rigrsure');
thr_cd3 = thselect(cd3,'rigrsure');
thr_cd2 = thselect(cd2,'rigrsure');
thr_cd1 = thselect(cd1,'rigrsure');
thr = [thr_cd7 thr_cd6 thr_cd5 thr_cd4 thr_cd3 thr_cd2 thr_cd1]
nc = wthcoef('t',c,l,1:8,thr,'s');

回答 (1 件)

Ayush
Ayush 2024 年 1 月 2 日
編集済み: Ayush 2024 年 1 月 2 日
I understand that you are getting the Invalid level value error. In your code, you have decomposed your signal yNoisy using the wavedec function up to level 7. However, when you are calling wthcoef, you're attempting to threshold levels 1 to 8, which is incorrect because you only have levels 1 to 7 available from your wavelet decomposition. You may refer to the documentation to see how to define the Detail levels in wthcoef: https://www.mathworks.com/help/wavelet/ref/wthcoef.html#mw_b067152c-8868-4892-9926-2a16c1ad16af
You may try this:
% Initialize the new coefficients array
nc = c;
% Threshold coefficients for each level
for lvl = 7:-1:1
nc = wthcoef('t', nc, l, lvl, thr(lvl), 's');
end
Thanks
Ayush

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by