# How to formulate the following matrices?

3 views (last 30 days)
M on 18 May 2022
Commented: M on 19 May 2022
How to formulate the following matrices? (which is called the transformation matrices)
Theta is the degree angle which stored in file 'Angles' ,,, x,y is the origins which stored in file origin
T = [cos(theta(i)) -sin(theta(i)) x(i)
sin(theta(i)) cos(theta(i)) y(i)
0 0 1]
##### 2 CommentsShowHide 1 older comment
Catalytic on 18 May 2022
Edited: Catalytic on 18 May 2022
I need help in iterating my thetas and origins into this matrix and storing the results.
You shouldn't. It's a trivial Matlab for-loop exercise.

Matt J on 18 May 2022
T=makehgtform('translate',[x(i),y(i),0],'zrotate',theta(i));
T=T([1,2,4],[1,2,4])

### More Answers (1)

Catalytic on 18 May 2022
Edited: Catalytic on 18 May 2022
Why not just -
T=zeros(3,3,n);
for i=1:n
T(:,:,i) = [cos(theta(i)) -sin(theta(i)) x(i)
sin(theta(i)) cos(theta(i)) y(i)
0 0 1];
end
##### 1 CommentShowHide None
M on 19 May 2022
@Catalytic, It could be also, but the above answer give you the transormation matrix directly without need to formulate it.