0% found this document useful (0 votes)
52 views1 page

Calcul de la Covariance et PCA

This document performs principal component analysis on data from 10 weather stations. It first centers the data by subtracting the mean from each row. It then calculates the covariance matrix and performs eigendecomposition to obtain the principal components, which are the eigenvectors of the covariance matrix. It projects the original data onto the principal components axes and plots the first two components to visualize the relationships between the stations.

Uploaded by

mourad_angouleme
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views1 page

Calcul de la Covariance et PCA

This document performs principal component analysis on data from 10 weather stations. It first centers the data by subtracting the mean from each row. It then calculates the covariance matrix and performs eigendecomposition to obtain the principal components, which are the eigenvectors of the covariance matrix. It projects the original data onto the principal components axes and plots the first two components to visualize the relationships between the stations.

Uploaded by

mourad_angouleme
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

load data_stations.

m ; data = data_stations' ; [M,N] = size(data); % calcul de la moyenne mn = mean(data,2); data = data - repmat(mn,1,N); % calucl de la matrice de covariance covariance = 1 / (N-1) * data * data'; % calcul des valeurs des vecteurs propres [PC, V] = eig(covariance); V = diag(V) ; % reordnner les variance [junk, rindices] = sort(-1*V); V = V(rindices); PC = PC(:,rindices); % projection des donnees signals = PC' * data; plot(signals(1,:),signals(2,:),'rx') xlabel('axe1'),ylabel('axe 2') title('Analyse en composante principale des variables dix stations' ) signals(1,:) PC ; signals ; covariance

You might also like