[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PCA demonstration

From: Hamish Allan
Subject: PCA demonstration
Date: Fri, 22 Apr 2005 00:01:52 +0100


I'm sorry to be asking this question, as I'm sure I could work out the answer eventually, but I'd really like to get this done tonight for a paper I need to get written in the next couple of days.

I need to create a visual demonstration what PCA does. I have a scatterplot:

n = 20;
d = [1:n; 1:n]' + randn(n, 2);

So, the data lies along a straight diagonal line with a bit of gaussian noise thrown in, and I want also to plot (on the same graph) the line showing the principle component (i.e., following the line of the data), and then lots of little lines (preferably dotted!) perpendicular to that, joining each datapoint to it (i.e., showing the projection from 2 dimensions into 1).

As I say, I'm sure with a gnuplot manual and a bit of time I could work out how to do this, but I wondered if any kind soul on the list, of whom there are many who could probably do this blindfolded before breakfast, could help me out?

Many thanks,

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]