wavelet denoising of signal

1 vue (au cours des 30 derniers jours)
MANINDER CHOUDHARY
MANINDER CHOUDHARY le 21 Mai 2022
Commenté : Voss le 22 Mai 2022
for i=1:21;
j=1:21;
C(i) = wdenoise(C,j, ...
Wavelet='sym1', ...
DenoisingMethod='Bayes', ...
ThresholdRule='Hard', ...
NoiseEstimate='LevelIndependent');
I want to denoise my signal but before that I want to check multiple denoising methods for my data. Can you please suggest how can I change value of each wavelet & denoising method, threshold rule etc using loop. So that after each loop it store denoised signal in an array Thanks
end

Réponse acceptée

Voss
Voss le 21 Mai 2022
Alternatively, something like this may be similar to what you had in mind:
C = randn(1,100);
methods = ["Bayes" "BlockJS" "FDR" "Minimax" "SURE" "UniversalThreshold"];
rules = ["James-Stein" "Soft" "Hard" "Median" "Mean"];
levels = 1:floor(log2(numel(C)));
n_methods = numel(methods);
n_rules = numel(rules);
n_levels = numel(levels);
result = cell(n_methods,n_rules,n_levels);
for jj = 1:n_methods
switch methods(jj)
case "Bayes"
valid_rules = ["Median" "Mean" "Soft" "Hard"];
case "BlockJS"
valid_rules = "James-Stein";
case "FDR"
valid_rules = "Hard";
otherwise
valid_rules = ["Soft" "Hard"];
end
[~,rules_idx] = ismember(valid_rules,rules);
for kk = 1:numel(rules_idx)
for ii = 1:n_levels
try
result{jj,rules_idx(kk),ii} = wdenoise(C,levels(ii), ...
Wavelet='sym1', ...
DenoisingMethod=methods(jj), ...
ThresholdRule=rules(rules_idx(kk)), ...
NoiseEstimate='LevelIndependent');
catch e
msg = sprintf('Unable to wdenoise with method %s, rule %s, level %d:\n%s', ...
methods(jj),rules(rules_idx(kk)),levels(ii),e.message);
disp(msg);
end
end
end
end
Unable to wdenoise with method BlockJS, rule James-Stein, level 6: For block thresholding, the level of the wavelet transform must be less than or equal to 5.
for jj = 1:n_methods
figure()
t = tiledlayout(n_levels,n_rules,'TileSpacing','none');
t.Title.String = sprintf('Method: %s',methods(jj));
t.YLabel.String = 'Level:';
t.Subtitle.String = 'ThresholdRule:';
for ii = 1:n_levels
for kk = 1:n_rules
nexttile();
box on
hold on
if ii == 1
title(rules(kk));
end
if kk == 1
ylabel(sprintf('%d',levels(ii)));
end
if ~isempty(result{jj,kk,ii})
plot(C)
plot(result{jj,kk,ii})
end
xticklabels([])
yticklabels([])
end
end
end
  2 commentaires
MANINDER CHOUDHARY
MANINDER CHOUDHARY le 22 Mai 2022
Thank you very much. It works (Y)
Voss
Voss le 22 Mai 2022
You're welcome!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by