Digital Signal Processing Reference
In-Depth Information
speech(1:N) ¼ orig(1:N); % Making the speech length a multiple of 1024 samples
rec_sig ¼ [];
for i ¼ 1:nofseg
sp ¼ speech((i-1)*1024 þ 1:i*1024);
w ¼ dwt(h0,sp,10);
% Quantization
w ¼ (round(2^15*w/2^15))*2^(15-15);
w(513:1024)
¼
zeros(1,512); % Omitting the high frequency coefficients
sp_rec
¼
idwt(h0,w,10);
rec_sig
¼
[rec_sig sp_rec
];
'
end
subplot(2,1,1),plot([0:length(speech)-1],speech,
k
);axis([0 20000 -20000 20000]);
'
'
ylabel(
);
subplot(2,1,2),plot([0:length(rec_sig)-1],rec_sig, ' k ' );axis([0 20000 -20000 20000]);
xlabel( ' Sample number ' );ylabel( ' Recovered x(n) CR ¼ 2:1 ' );
NN ¼ min(length(speech),length(rec_sig));
err ¼ rec_sig(1:NN)-speech(1:NN);
SNR ¼ sum(speech.*speech)/sum(err.*err);
disp( ' PR reconstruction SNR dB ¼ > ' );
SNR ¼ 10*log10(SNR)
Figure 13.44 displays the wavelet compression for 16-bit ECG data using Program 13.3. The
reconstructed ECG data has a compression ratio of 2:1 with SNR ¼ 33.8 dB.
Figure 13.45 illustrates an application of signal denoising using the DWTwith a coefficient threshold.
During the analysis stage, an obtained DWT coefficient (quantization is not necessary) is set to zero if its
value is less than the predefined threshold depicted in Figure 13.45 . This simple technique is called the
hard threshold. Usually, the small wavelet coefficients are related to the high frequency components in
signals. Therefore, setting high frequency components to zero is the same as lowpass filtering.
An example is shown in Figure 13.46 . The first plot depicts a 40-Hz noisy sinusoidal signal (sine
wave plus noise with SNR ¼ 18 dB) and the clean signal with a sampling rate of 8,000 Hz. The second
plot shows that after zero threshold operations, 67% of coefficients are set to zero and the recovered
signal has SNR ¼ 19 dB. Similarly, the third and fourth plots illustrate that 93% and 97% of coef-
ficients are set to zero after threshold operations and the recovered signals have SNR ¼ 23 and 28 dB,
respectively. As an evidence that the signal is smoothed, that is, high frequency noise is attenuated, the
wavelet denoising technique is equivalent to lowpass filtering.
Original data x(n)
'
'
13.8 MATLAB PROGRAMS
In this section, four key MATLAB programs are listed. rconv() and fconv() perform circular
convolutions with the reversed filter coefficients and the forward filter coefficients, respectively. dwt()
and idwt() are the programs to compute the DWT coefficients and IDWT coefficients. The resolution
level can be specified.
Program 13.4. Circular convolution with the reversed filter coefficients (rconv.m).
function [y]
rconv(h,c)
% Circular convolution using the reversed filter coefficients h(-k)
¼
 
Search WWH ::




Custom Search