[x,Fs]=audioread('d00.wav');
t=(0:length(x)-1)/Fs; %计算样本时刻
noise=0.2*rand(length(x),1);
noise1 = wgn(length(x),1,-30);
x0=x; %原始信号
x=x+noise1;
subplot(331); plot(t,x0); ylabel('幅度'); xlabel('时间(s)'); title('原始心音信号');
subplot(332); plot(t,x); ylabel('幅度'); xlabel('时间(s)'); title('含噪心音信号');
ylim([-1 1]);
[xd1,xd2,xd3,xd4,xd5,xd6]=softthersh(x,6,'db6');
subplot(333); plot(t,xd1); ylabel('幅度'); xlabel('时间(s)'); title('硬阈值心音信号');
subplot(334); plot(t,xd2); ylabel('幅度'); xlabel('时间(s)'); title('软阈值心音信号');
subplot(335); plot(t,xd3); ylabel('幅度'); xlabel('时间(s)'); title('半软阈值心音信号');
subplot(336); plot(t,xd4); ylabel('幅度'); xlabel('时间(s)'); title('Minimax阈值心音信号');
subplot(337); plot(t,xd5); ylabel('幅度'); xlabel('时间(s)'); title('Garrote阈值心音信号');
subplot(338); plot(t,xd6); ylabel('幅度'); xlabel('时间(s)'); title('改进阈值心音信号');
% subplot(339); plot(t,xd7); ylabel('幅度'); xlabel('时间(s)'); title('新改进阈值心音信号');
[SNR1,RMSE1]=Evaluate(x0,xd1);
[SNR2,RMSE2]=Evaluate(x0,xd2);
[SNR3,RMSE3]=Evaluate(x0,xd3);
[SNR4,RMSE4]=Evaluate(x0,xd4);
[SNR5,RMSE5]=Evaluate(x0,xd5);
[SNR6,RMSE6]=Evaluate(x0,xd6);
% [SNR7,RMSE7]=Evaluate(x0,xd7);