wavelet denoising of signal
조회 수: 3 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
Voss
2022년 5월 21일
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
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Signal Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!