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 次查看(过去 30 天)
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 个评论
Steven Lord
Steven Lord 2024-11-10,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.

请先登录,再进行评论。

回答(2 个)

Matt J
Matt J 2024-11-10,12:51
Consider polyshape

Walter Roberson
Walter Roberson 2024-11-10,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

类别

Help CenterFile Exchange 中查找有关 Object Containers 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by