B23366 Lab2
B23366 Lab2
Data Science
Lab-2 Report
Ayush Sawarn
B23366
Simulation Setup
1. Input Space Definition: - The input space is defined as R2 , where each point in
the space is represented as a vector [x, y]T . - The coordinate limits for both x and y are
set from -1 to 3, with unit spacing.
3. Plotting Setup: - A new figure is initialized using the ‘figure‘ command to create
a visual representation of the input space and transformations. - The original input space
is plotted using solid red lines for horizontal grid lines and dashed blue lines for vertical
grid lines. The ‘plot‘ function is employed to achieve this, with ‘hold on‘ allowing multiple
plots within the same figure. - The ‘axis equal‘ command ensures that the aspect ratio of
the plot is maintained, allowing for accurate visual interpretation of distances and angles.
4. Matrix Transformations:
2 0
• T1 = (scaling transformation)
0 1
1 0
• T2 = (scaling transformation)
0 3
2 0
• T3 = (uniform scaling transformation)
0 2
1
1 −1
• T4 = √1 (reflection and rotation transformation)
1 1
2
1 0
• T5 = (reflection transformation)
0 −1
5. Transformation Application: - Each transformation matrix is applied to the
grid points stored in matrix ‘XY‘, which contains all x and y coordinates reshaped into
column vectors. - The transformed coordinates are computed by multiplying each trans-
formation matrix with the original coordinate matrix.
The generated input space consists of a uniform grid defined over the range from -1
to 3 for both x and y coordinates. The horizontal grid lines are represented by solid red
lines while vertical grid lines are shown as dashed blue lines. This visual representation
allows us to observe how points in R2 are distributed evenly across this defined area,
2
providing a clear foundation for applying linear transformations effectively.
Each matrix transformation alters the shape and orientation of the original grid in distinct
ways:
2 0
- Transformation T1 = : This scaling transformation stretches the grid hori-
0 1
zontally by a factor of 2 while leaving it unchanged vertically, resulting in an elongated
shape along the x-axis.
1 0
- Transformation T2 = : This scaling transformation compresses the grid
0 3
vertically by a factor of 3 while maintaining its horizontal dimensions, leading to a taller
and narrower shape.
2 0
- Transformation T3 = : This uniform scaling transformation enlarges both
0 2
dimensions equally by a factor of 2, resulting in a uniformly stretched grid that retains
3
its proportions.
√1
1 −1
- Transformation T4 = : This reflection and rotation transformation
2 1 1
reflects points across the line y = x while rotating them counterclockwise by 45◦ , altering
both shape orientation and position.
1 0
- Transformation T5 = : This reflection transformation flips points across
0 −1
the x-axis, resulting in an inverted version of the original grid.