×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

help with matlab code/math

help with matlab code/math

help with matlab code/math

(OP)
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.


RE: help with matlab code/math

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources