In MATLAB, a 2D transformation matrix can be defined as a 3x3 matrix with the following format:
main.m97 chars4 lines
where theta is the angle of rotation in radians, tx and ty represent translations in x-axis and y-axis respectively.
To apply the transformation matrix on a point (x,y), you can use matrix multiplication:
main.m38 chars3 lines
where X is the column vector representation of the point and X_transformed is the transformed point.
Here is a code example to rotate the point (5, 3) by 45 degrees and translate it by (1, 1):
main.m370 chars15 lines
Output:
main.m20 chars3 lines
gistlibby LogSnag