MAT350 5.2 MATLAB: Linear Transformations
In this activity you will create a linear transformation matrix and apply it to a set of points, creating a plot of the original and rotated polygons.
The following matrix represents a linear transformation from to ,rotating each point counterclockwise about the origin by an angle , in radians.
A = [ cos(theta) -sin(theta)]
sin(theta) cos(theta)
The standard matrix A that rotates a point 45 degrees counterclockwise about the origin is given below.
A = [cos(pi/4) -sin(pi/4); sin(pi/4) cos(pi/4)]
Create a matrix S containing the points of the unit square as the columns. Order the points as they would be traversed when drawing the edges of the square, repeating the starting point so that the drawing starts and ends there.
S = [0 1 1 0 0; 0 0 1 1 0]
Plot the unit square.
plot(S(1,:), S(2,:))
Perform matrix multiplication to transform each of the points in S.
T1 = A*S
Plot the original unit square and the transformed unit square.
plot(S(1,:), S(2,:), T1(1,:),
Reviews
There are no reviews yet.