1
$\begingroup$

I have been stuck on my school project that consists of independent component analysis.

My code will run, but only 50-60% of the time it unmixes the signals. Another problem I have is the amplitudes of the signals are off to the point where I can barely hear the unmixed sound.

Input is very much appreciated. This is my first DSP project. This code is written in MatLab.

See code below. `

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*****');

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

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

mx = sum(x, 2)/ss; %mean of x 
xx = x - repmat(mx, 1, ss); %centering data

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

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

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

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


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


while abs(abs(w'*w0)-1) > size(w,1)
     w0 = w;
     w = (x*D(w'*x)'/ss) - (sum(SD(w'*x))*w)/ss;  
     % w = E{xg(w^{T}*x)} - E{g'(w^{T}*x)}w
     w = w/norm(w,2);

     w = gramschmidt(w); %Orthogonalize w
end

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

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

figure;
subplot(3,1,1);plot(m1);
subplot(3,1,2);plot(f1);
subplot(3,1,3);plot(w'*x);`
$\endgroup$
  • $\begingroup$ Is anyone available to review and assist? $\endgroup$ – QuantumElectro Nov 27 '19 at 1:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.