📄 a533.asv
字号:
%给定一个正弦信号并图示之
t=0:1000;
s=sin(0.03*t);
subplot(3,1,1);
plot(s);
axis([0 1000 -1.2 1.2]);
title('原始信号');
%=============================
%给该信号加噪声
ns = awgn(s,16) ;
%load noissin;
%ns=noissin;
subplot(3,1,2);
plot(ns);
axis([0 1000 -1.2 1.2]);
title('染噪信号');
%=============================
%进行消噪处理
xd1=wden(ns,'minimaxi','s','one',5,'db1');
subplot(3,1,3);
plot(xd);
axis([0 1000 -1.2 1.2]);
title('消噪信号1');
xd2=wden(ns,'minimaxi','s','one',5,'db2');
figure,subplot(3,1,1);
plot(xd2);
axis([0 1000 -1.2 1.2]);
title('消噪信号2');
xd3=wden(ns,'minimaxi','s','one',5,'db3');
subplot(3,1,2);
plot(xd3);
axis([0 1000 -1.2 1.2]);
title('消噪信号3');
xd4=wden(ns,'minimaxi','s','one',5,'db4');
subplot(3,1,3);
plot(xd4);
axis([0 1000 -1.2 1.2]);
title('消噪信号4');
xd5=wden(ns,'minimaxi','s','one',5,'db5');
subplot(3,1,3);
plot(xd5);
axis([0 1000 -1.2 1.2]);
title('消噪信号5');
xd6=wden(ns,'minimaxi','s','one',5,'db6');
subplot(3,1,3);
plot(xd6);
axis([0 1000 -1.2 1.2]);
title('消噪信号6');
xd7=wden(ns,'minimaxi','s','one',5,'db7');
subplot(3,1,3);
plot(xd7);
axis([0 1000 -1.2 1.2]);
title('消噪信号7');
xd8=wden(ns,'minimaxi','s','one',5,'db8');
subplot(3,1,3);
plot(xd8);
axis([0 1000 -1.2 1.2]);
title('消噪信号8');
xd9=wden(ns,'minimaxi','s','one',5,'db9');
subplot(3,1,3);
plot(xd4);
axis([0 1000 -1.2 1.2]);
title('消噪信号4');
p1=1/length(ns)*norm(ns).^2;
p2=1/length(xd)*norm(ns-xd).^2;
snr=10*log(p1/p2)
p1=1/length(ns)*norm(ns).^2;
p2=1/length(xdd)*norm(ns-xdd).^2;
snr=10*log(p1/p2)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -