Following code, when run shows "Error using wthcoef (line 58). Invalid level value". What do I do to correct it?
조회 수: 3 (최근 30일)
이전 댓글 표시
[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');
댓글 수: 0
답변 (1개)
Ayush
2024년 1월 2일
편집: Ayush
2024년 1월 2일
Hi @Sayan Mitra
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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!