%Script file for "noisy circle" t=linspace(0,100,1500); X=[cos(t') sin(t') 0.1*randn(1500,1)]; Mix=randn(3,3); Z=X*Mix; Mix =[ -0.3560 0.7018 -1.2267 -1.8924 -0.2936 3.0195 0.4906 -0.5868 1.6093]; figure(1) plot3(Z(:,1),Z(:,2),Z(:,3)); Z=Z-repmat(mean(Z),1500,1); %Mean subtract [U,S,V]=svd((1/1500)*Z'*Z); %Covariance Y=Z*U; %This is the data in the PCA Coordinates figure(2) subplot(3,1,1) plot(Y(:,1)); subplot(3,1,2) plot(Y(:,2)); subplot(3,1,3) plot(Y(:,3)); [U,V,P,C,S]=gsvd(Z,diff(Z),0); %Clean signals in U figure(3) subplot(3,1,1) plot(U(:,1)); subplot(3,1,2) plot(U(:,2)); subplot(3,1,3) plot(U(:,3));