阈值化后是否重构信号?

时间:2018-09-11 12:54:57

标签: matlab signal-processing threshold adaptive-threshold

我想通过对小波系数进行阈值重构来重构一维音频信号。首先,我读取音频信号并将其标准化。之后,我添加了白色高斯噪声。随后,我计算了分解的最大体积水平。

我使用return ResponseEntity .ok() .contentType(MediaType.IMAGE_GIF); 小波对噪声信号进行了多级小波分解,并获得了近似系数和详细系数。对于使用db8的阈值计算,我获得了硬阈值的阈值,并将此阈值应用于小波系数。最后,我使用universal threshold formula使用新系数重建原始信号。

waverec

我收到一个错误,该错误期望clear all close all clc [x,Fs] = audioread('audio8.wav'); %Read cough sound sound(x,Fs) figure plot(x(1:end,1)) grid on title('Original Cough Sound') xlabel('Frequency (Hz)') ylabel('Amplitude') x = x/abs(max(x)); %Normalization of Cough Sound normalized_snr = snr(x,Fs); %SNR of Normalized Cough Sound figure plot(x) grid on title('Normalized Cough Sound') xlabel('Frequency (Hz)') ylabel('Amplitude') gauss_noise = awgn(x,20,'measured'); %Adding White Gaussian Noise sound(gauss_noise,Fs) noisy_snr = snr(gauss_noise,Fs); %SNR of Noisy Cough Sound figure plot(gauss_noise) grid on title('Noisy Cough Sound') xlabel('Frequency (Hz)') ylabel('Amplitude') len = length(gauss_noise); disp(len) level = fix(log2(len)); disp(level) wn = 'db8'; [c,l] = wavedec(gauss_noise,level,wn); %calculate threshold sigma = median(abs(c))/0.6745; thresh = sqrt(2*log(length(gauss_noise)))*sigma; disp(thresh) for i = 1:level det = detcoef(c,l,i); y_det_hard = wthresh(det,'h',thresh); figure plot(y_det_hard) grid on end for j = 1:level app = appcoef(c,l,'db8',j); % y_app_hard = wthresh(app,'h',thresh); figure plot(app) grid on end app_last = appcoef(c,l,'db8',level); app_last_hard = wthresh(app_last,'h',thresh); disp(app_last_hard) figure plot(app_last_hard) grid on new_coeff = [app_last_hard + y_det_hard]; len2 = length(new_coeff); y_rec = waverec(new_coeff,len2,'db8'); %Perform wavelet reconstruction on new coefficients after thresholding figure plot(y_rec) grid on 是值为N的标量。我是否以正确的方式将阈值应用于小波系数?为什么我无法重建信号?

0 个答案:

没有答案