http://www.ilovematlab.cn/forum.php?mod=viewthread&tid=201598
t=linspace(0,2.5,2500);
N=length(t);
dt=t(2)-t(1);
fs=1/dt;
x=2*sin(2*pi*t)+2*sin(4*pi*t)+2*sin(6*pi*t);
x=x-mean(x);
[y,noise]=noisegen(x,10);
figure(1);
subplot(311);
plot(x);
subplot(312);
plot(noise);
subplot(313);
plot(y);
snr=snrsinglelech(x,y)
function snr = snrsinglelech(I,In )
%计算信号的噪声比,I为纯信号,In为染噪信号
ps=sum(sum((I-mean(I)).^2));
pn=sum(sum((I-In).^2));
snr=10*log10(ps/pn);
end
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载
- 1
- 2
前往页