% 读入信号数据
load('signal.mat'); % 替换为实际的信号数据加载方式
% 小波分解
level = 5; % 分解层数
wname = 'db4'; % 小波基函数
[C, L] = wavedec(signal, level, wname);
% 阈值处理
threshold = 0.2; % 阈值
sorh = 's'; % 软阈值
C_denoised = wthresh(C, sorh, threshold);
% 重构信号
signal_denoised = waverec(C_denoised, L, wname);
% 绘制信号和去噪后的信号
figure;
subplot(2,1,1);
plot(signal);
title('原始信号');
subplot(2,1,2);
plot(signal_denoised);
title('去噪后的信号');