【问题标题】:FastICA Implementation.. MatlabFastICA 实现.. Matlab
【发布时间】:2020-03-22 13:18:37
【问题描述】:

我一直在使用 MatLab 实现 FastICA 算法。目前,代码并没有像 id 那样分离信号。我想知道这里是否有人可以就如何解决这个问题给我一些建议?

disp('*****Importing Signals*****');

s = [1,30000];

[m1,Fs1] = audioread('OSR_us_000_0034_8k.wav', s);
[f1,Fs2] = audioread('OSR_us_000_0017_8k.wav', s);

ss = size(f1,1);
n = 2; 

disp('*****Mixing Signals*****');

A = randn(n,n); %developing mixing matrix 

x = A*[m1';f1']; %A*x

m_x = sum(x, n)/ss; %mean of x 

xx = x - repmat(m_x, 1, ss); %centering the matrix 

c = cov(x');
sq = inv(sqrtm(c)); %whitening the data 
x = c*xx;

D = diff(tanh(x)); %setting up newtons method 
SD = diff(D);

disp('*****Generating Weighted Matrix*****');

w = randn(n,1); %Random weight vector
w = w/norm(w,2); %unit vector
w0 = randn(n,1);
w0 = w0/norm(w0,2); %unit vector

disp('*****Unmixing Signals*****');

while abs(abs(w0'*w)-1) > size(w,1)

   w0 = w;
   w = x*D(w'*x) - sum(SD'*(w'*x))*w;  %perform ICA
   w = w/norm(w, 2);

end

disp('*****Output After ICA*****');

sound(w'*x); % Supposed to be one of the original signals

subplot(4,1,1);plot(m1); title('Original Male Voice'); 
subplot(4,1,2);plot(f1); title('Original Female Voice'); 
subplot(4,1,4);plot(w'*x); title('Post ICA: Estimated Signal');

%figure;
%plot(z); title('Random Mixed Signal');

%figure;
%plot(100*(w'*x)); title('Post ICA: Estimated Signal');

【问题讨论】:

  • " 代码没有像 id 那样分离信号" 这是什么意思?你怎么指望有人用这么少的信息来帮助你?你应该阅读How to Askminimal-reproducible-example。此外,您应该添加有关所需输出的信息以及当前输出的问题是什么......

标签: matlab statistics signal-processing


【解决方案1】:

您的协方差矩阵 c 是 2 乘 2,您无法使用它。您必须将信号与随机数多次混合才能到达任何地方,因为您必须有一些不同通道共有的信号 (m1)。我无法按照您的快速 ICA 代码进行操作,但这是一个 PCA 示例:

url = {'https://www.voiptroubleshooter.com/open_speech/american/OSR_us_000_0034_8k.wav';...
    'https://www.voiptroubleshooter.com/open_speech/american/OSR_us_000_0017_8k.wav'};
%fs = 8000;
m1 = webread(url{1});
m1 = m1(1:30000);
f1 = webread(url{2});
f1 = f1(1:30000);
ss = size(f1,1);
n = 2; 
disp('*****Mixing Signals*****');
A = randn(50,n); %developing mixing matrix 
x = A*[m1';f1']; %A*x
[www,comp] = pca(x');
sound(comp(:,1)',8000)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-11
    • 1970-01-01
    • 2016-10-24
    • 2017-08-01
    • 2015-05-20
    • 1970-01-01
    • 2013-03-06
    • 2012-01-22
    相关资源
    最近更新 更多