"Caio " <caiovtrich@gmail.com> wrote in message <ing7gs$3g5$1@fred.mathworks.com>...
> Hi,
> First i manipulate my images from orange trees with citrus canker to obtain histograms. I think that applying the PCA method in this histograms i can observe the the time evolution of the disease. In this case, i have many histograms that each one can be a pair of vectors. My objective is try to see some relations when i plot the first and second principal components.
> Are you understand?
> Thanks.
>
> "Florin Neacsu" <fneacsu2@gmail.com> wrote in message <infvuv$bl$1@fred.mathworks.com>...
> > "Caio " <caiovtrich@gmail.com> wrote in message <infpg9$6op$1@fred.mathworks.com>...
> > > Hi,
> > > I am having problens with doing the PCA analysis. I want to plot the first and second principal components of a image histogram. Here is my rotine.
> > > X1 and Y1 are columns of my histrogam
> > >
> > >
> > > % Applying Principal Component Analysis  PCA
> > >
> > > %step 1, finding a mean and subtracting
> > > X1mean=mean(X1);
> > > Y1mean=mean(Y1);
> > >
> > > [a,b]=size(X1);
> > > X1new=X1X1mean*ones(a,1);
> > > Y1new=Y1Y1mean*ones(a,1);
> > >
> > > subplot(5,1,2);
> > > plot(X1,Y1, 'o');
> > > title('Histogram Data');
> > >
> > > subplot(5,1,3);
> > > plot(X1new,X1new, 'o');
> > > title('mean is deducted')
> > >
> > > % step 2  Covariance Matrix
> > > covariancematrix=cov(X1new,Y1new);
> > >
> > > % step 3  Finding Eigenvectors
> > > [V,D] = eig(covariancematrix);
> > > D=diag(D);
> > > maxeigval=V(:,find(D==max(D)));
> > >
> > > % step 4  Deriving the new data set
> > > % Finding the projection onto the eigenvectors
> > >
> > > finaldata=maxeigval'*[X1new,Y1new]';
> > > subplot(5,1,4);
> > > stem(finaldata, 'DisplayName', 'finaldata', 'YDataSource', 'finaldata');
> > > title('PCA output ')
> > >
> > > Someone can help me?
> > > Thanks.
> >
> >
> > Hi,
> >
> > What is your objective ? What are you hopping to obtain from your PCA ?
> > Are you applaying PCA to two vectors, which are obtain from a histogram ?
> >
> > Regards,
> >
> > Florin
Hi,
I don't fully understand. Your inputs are 2 vectors. Are these vectors coming from one histogram or more ?
Florin
