Following code, when run shows "Error using wthcoef (line 58). Invalid level value". What do I do to correct it?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
[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 comentarios
Respuestas (1)
Ayush
el 2 de En. de 2024
Editada: Ayush
el 2 de En. de 2024
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 comentarios
Ver también
Categorías
Más información sobre Digital Filtering en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!