Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with matlab code/math

Status
Not open for further replies.

xargon

Computer
Nov 2, 2005
1
Hi everyone,


I am trying to understand a particular piece of Matlab code and finding out what it does. Unfortunately, the code does not have much comments and I do not know who the author is. I was wondering if any experts here can take a look at it and help me understand what it actually does.

function ret = find_principal_coordinatess(Ps)

% INPUT: Ps = a set of N point coordinates in a 3 x N or 4 x N (homogeneous form) matrix


X = Ps(1:3,:)';
N = size(X,1);
Xm = mean(X);
%Pcentroid = Xm';
X0 = X - repmat(Xm,N,1);
[UX,DX,VX] = svd(X0);
Paxes = [VX:),1:2), cross(VX:),1),VX:),2))];
V1 = repmat(Paxes:),1)',N,1);
V2 = repmat(Paxes:),2)',N,1);
V3 = repmat(Paxes:),3)',N,1);
ret = [sum(X0.*V1,2) sum(X0.*V2,2) sum(X0.*V3,2)]';


Thanks,
-xar

I think it takes a matrix and returns a reference coordinate according to some central values...(?). I am not exactly sure. I would be really grateful if someone could help with this.


 
Replies continue below

Recommended for you

Looks like an eigen (or in this case specifically an svd) data compression. See Jain, "Fundamentls of Digital Image Processing" for a good explanation. Here is a guess:

For eigen compression you need to remove the mean from the data, In the case you have the mean is removed from each location. I think it is only compression if the data is 4D and it estimates the best lower dimensionl 3D description.

If it is 4D it may be rotating the view so that the new coordinates are maximally decorelated.

i.e. if you had a scatter plot of dat that looked kind of like an ellipse 45 degrees on a dart board. In the cartesiona XY you would have a 2D set of data like your 3 and 4 D data problem. Now if you made a new set of XY axis where X was 45 degrees and went along the major axis of the elipse you could use a 1D representation of the data and you would only loose information on the minor axis, which would be less loss than if you stuck with the old original dart board XY axis and threw away any Y data in your compression.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor