# ICA - Exercise Problem from book - Matlab Code

Im trying to do a problem of ICA from a Image Processing book, but when I finish I got the Matrix C different from the one in the exercise. This is the Exercise: This is my Matlab Code:

t=1:1000;
f=sin(t*pi/19);
g=sin(pi*t/5)+sin(pi*t/31);
h=mod(.3*t,1.5);
m1=.3*f+.4*g+.3*h;
m2=.5*f+.2*g+.3*h;
m3=.1*f+.1*g+.8*h;
mn=[m1;m2;m3];
m1p=m1-mean2(mn);
m2p=m2-mean2(mn);
m3p=m3-mean2(mn);
mnp=[m1p;m2p;m3p;];
C=(mnp*mnp')/3;
[V,D]=eig(C);
eigenvalues=diag(D);
eigenvector=V;


My result in the Matrix C is:

C =

77.2656   60.7483   26.2664
60.7483   64.0480   23.0485
26.2664   23.0485   56.4664


This are the steps of the algorithm: Then there is some info about applying to Signal Processing:

My problem is I don't get the same Matrix C from the exercise.

## 1 Answer

In the line

C=(mnp*mnp')/3


you're dividing by 3 when you should really be dividing by the number of observations, which is 1000 in your case.

• Oh you are right, it didnt look the same, but very close : C = 0.2318 0.1822 0.0788 0.1822 0.1921 0.0691 0.0788 0.0691 0.1694 ! thank you very much Apr 22 '15 at 12:08