sound=wavread('voice.wav');
size(sound)
ans =
117306 2
plot(sound);
count1=length(sound);
noise=0.05*randn(1,count1);
size(noise)
ans =
1 117306
noise=0.05*randn(2,count1);
size(noise)
ans =
2 117306
s=sound';
y=s+noise;
plot(y);
net=newff(minmax(s),[8 2],{'tansig','purelin'},'trainlm');
net.trainParam.epochs=600; %最大训练次数
net.trainparam.goal=0.001; %要求误差
lp.lr=0.1; %学习速率
net=train(net,s,y);
x=sim(net,s);
sum1=0;
sum2=0;
sum3=0;
[l,h]=size(s);
for i=1:l
sum1=sum(s(i,:).^2);
sum2=sum((y(i,:)-s(i,:)).^2);
sum3=sum((x(i,:)-s(i,:)).^2);
end
SNR1=10*log10((sum1/sum2))
SNR2=10*log10((sum1/sum3))
评论0
最新资源