MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Ian
on 25 Oct 2012

I have the coordinates of 9 points and I am trying to use them to construct 3 coordinate systems and determine the transformation matrices between the global and each local coordinate system. This is what I have so far (Not very filled in I know that's why I'm looking for help)

%Create 3 Local CS

or_Fm=

v1 = m1 - m2;

v2 = m3 - m2;

v3 = cross(v1,v2);

v4 = cross(v3,v1);

i_Fm = v1/norm(v1);

j_Fm = v4/norm(v4);

k_Fm = v3/norm(v3);

or_Fa=

v1 = m1 - m2;

v2 = m3 - m2;

v3 = cross(v1,v2);

v4 = cross(v3,v1);

i_Fa = v1/norm(v1);

j_Fa = v4/norm(v4);

k_Fa = v3/norm(v3);

or_Mm=

v1 = m1 - m2;

v2 = m3 - m2;

v3 = cross(v1,v2);

v4 = cross(v3,v1);

i_Mm = v1/norm(v1);

j_Mm = v4/norm(v4);

k_Mm = v3/norm(v3);

or_Ma=

v1 = m1 - m2;

v2 = m3 - m2;

v3 = cross(v1,v2);

v4 = cross(v3,v1);

i_Ma = v1/norm(v1);

j_Ma = v4/norm(v4);

k_Ma = v3/norm(v3);

%Compute Tranfromation Matrices

T_Fm=eye(4);

T_Fm(2:4,1)=or_Fm;

T_Fm(2:4,2:4)=[i_Fm j_Fm k_Fm]

T_Fa=eye(4);

T_Fa(2:4,1)=or_Fa;

T_Fa(2:4,2:4)=[i_Fa j_Fa k_Fa]

T_Mm=eye(4);

T_Mm(2:4,1)=or_Mm;

T_Mm(2:4,2:4)=[i_Mm j_Mm k_Mm]

T_Ma=eye(4);

T_Ma(2:4,1)=or_Ma;

T_Ma(2:4,2:4)=[i_Ma j_Ma k_Ma]

*No products are associated with this question.*

## 2 Comments

## Matt Kindig (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/51909#comment_107344

What is the relationship between i_Fm and i_Fa? Similarly, what is the relationship between i_Mm and i_Ma? Which two coordinate systems is the transformation matrix T_Fm transforming between?

## Image Analyst (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/51909#comment_107362

A diagram would help. What are you trying to do? Warp a 2D image into a "fixed up" image? I know you think the two comments you put in there explain it all, but they don't do it for me. What are x3 and x9 in your subject line - those variables do not seem to be in the code. Does that mean you have three transformation matrices and 9 coordinate pairs? Why are you not using maketform() or imtransform()? I suggest you look at this from our point of view and edit this to provide us with enough information to give us a fighting chance at helping you.