Develop a generalize MATLAB code to * perform the following transformations on a pentagon defined by the points A, B, C, D, and E, where the coordinates are based on the last

22 views (last 30 days)
Develop a generalize MATLAB code to * perform the following transformations on a pentagon defined by the points A, B, C, D, and E, where the coordinates are based on the last two digits of your roll number: (Function for generation of the coordinates of pentagon is provided below)
A: (X1, Y1)
B: (X2,Y2)
C: (X3, Y3)
D: (X4, Y4)
E: (X5, Y5)
Perform the following transformations on the pentagon:
a) Translation of all the points by (60,70) in x and y directions.
b) Shear the original pentagon with shy = 2.
c) Rotate the original pentagon about the y-axis by 30 degrees.
d) Reflect the whole pentagon about the y-axis.
Plot all transformations in a single figure window.
  1 Comment
Steven Lord
Steven Lord on 10 Nov 2024 at 13:17
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the free MATLAB Onramp tutorial to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.

Sign in to comment.

Answers (2)

Matt J
Matt J on 10 Nov 2024 at 12:51
Consider polyshape

Walter Roberson
Walter Roberson on 10 Nov 2024 at 21:19
Create the required pentagram object.
Now, create one hgtransform object for each of the required transformations; parent the hgtransform object to the same axis that you created the basic pentagram into.
copyobj() the basic pentagram graphics object once into each of the hgtransform() objects.
Now, set the Matrix property of each of the hgtransform objects to reflect the required transformation. You may find it easiest to use makehgtform

Categories

Find more on Object Containers in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!