Main Content

Wavelet Denoising

This example shows how to use thedsp.DyadicAnalysisFilterBankanddsp.DyadicSynthesisFilterBankSystem objects to remove noise from a signal.

Introduction

Wavelets have an important application in signal denoising. After wavelet decomposition, the high frequency subbands contain most of the noise information and little signal information. In this example, soft thresholding is applied to the different subbands. The threshold is set to higher values for high frequency subbands and lower values for low frequency subbands.

Initialization

Creating and initializing the System objects before they are used in a processing loop is critical in obtaining optimal performance.

loaddspwlets;% load wavelet coefficients and noisy signalThreshold = [3 2 1 0];

Create adsp.SignalSourceSystem object™ to output the noisy signal.

signalGenerator = dsp.SignalSource(noisdopp.', 64);

Create and configure aDyadicAnalysisFilterBankSystem object for wavelet decomposition of the signal.

dyadicAnalysis = dsp.DyadicAnalysisFilterBank(...'CustomLowpassFilter', lod,...'CustomHighpassFilter', hid,...'NumLevels', 3);

Create threeDelaySystem objects to compensate for the system delay introduced by the wavelet components.

delay1 = dsp.Delay(3*(length(lod)-1)); delay2 = dsp.Delay(length(lod)-1); delay3 = dsp.Delay(7*(length(lod)-1));

Create and configure aDyadicSynthesisFilterBankSystem object for wavelet reconstruction of the signal.

dyadicSynthesis = dsp。DyadicSynthesisFilterBank (...'CustomLowpassFilter', lor,...'CustomHighpassFilter', hir,...'NumLevels', 3);

Create atimescopeSystem object to plot the original, denoised and residual signals.

scope = timescope('Name','Wavelet Denoising',...'SampleRate', fs,...'TimeSpan', 13,...'NumInputPorts', 3,...'LayoutDimensions',[3 1],...'TimeAxisLabels','Bottom',...'TimeSpanOverrunAction','Scroll'); pos = scope.Position; scope.Position = [pos(1) pos(2)-(0.5*pos(4)) 0.9*pos(3) 2*pos(4)];% Set properties for each display范围。ActiveDisplay = 1; scope.Title ='Input Signal';范围。ActiveDisplay = 2;范围。Title ='Denoised Signal';范围。ActiveDisplay = 3; scope.Title ='Residual Signal';

Stream Processing Loop

Create a processing loop to denoise the input signal. This loop uses the System objects you instantiated above.

forii = 1:length(noisdopp)/64 sig = signalGenerator();% Input noisy signalS = dyadicAnalysis(sig);% Dyadic analysis% separate into four subbandsS1 = S(1:32); S2 = S(33:48); S3 = S(49:56); S4 = S(57:64);% Delay to compensate for the dyadic analysis filtersS1 = delay1(S1); S2 = delay2(S2); S1 = dspDeadZone(S1, Threshold(1)); S2 = dspDeadZone(S2, Threshold(2)); S3 = dspDeadZone(S3, Threshold(3)); S4 = dspDeadZone(S4, Threshold(4));% Dyadic synthesis (on concatenated subbands)S = dyadicSynthesis([S1; S2; S3; S4]); sig_delay = delay3(sig);% Delay to compensate for analysis/synthesis.Error = sig_delay - S;% Plot the resultsscope(sig_delay, S, Error);endrelease(scope);

Summary

This example used signal processing System objects such as theDyadicAnalysisFilterBankandDyadicSynthesisFilterBankto denoise a noisy signal using user-specified thresholds. The Input Signal window shows the original noisy signal, the Denoised Signal window shows the signal after suppression of noise, and the Residue Signal window displays the error between the original and denoised signal.