⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 new_nag.m

📁 这是盲信号的代码 都已经通过编译了 做这方面的同仁可以参考一下 我觉得蛮惯用的
💻 M
字号:
function [y,PI] = new_nag()
%
%A  natural gradient-based Algorithm for Blind Source Separation
%copyright 2005.4.14
%author:lucky zhang
%used to separate audio signal
%usage:[y,PI]=based_neg(x)
%where x is the mixed signal
%y is the separation signal
%PI is the performance 
s1=wavread('man.wav');
s2=wavread('women.wav');
s=[s1';s2'];
[dim,sample]=size(s);
A=rand(dim);
x=A*s;

fprintf('mixed signal has %d dim\n',dim);
fprintf('mixed signal has %d sample\n',sample);
x=baihua(x);
W=rand(dim);
u=0.001;
I=eye(dim);
for i=1:sample
    y(:,i)=W'*x(:,i);
    fy(:,i)=2*tanh(y(:,i));
    D=diag(diag(fy(:,i)*y(:,i)'));
    W=W+u*(I-fy(:,i)*y(:,i)')*W;
    W=W/norm(W);
     PI(i)=xnzb(W*A);
end
y=W'*x;
n=dim;
figure(1);
m=1:sample;
t=m/16000;
plot(t,PI);
figure(2);
subplot(221)
plot(t,s1');
subplot(223);
plot(t,s2');
subplot(222);
plot(t,y(1,:));
subplot(224);
plot(t,y(2,:));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -