MATLAB Help Needed: Add Axis, Draw Arm Pieces, Rotate Objects

  • Thread starter Thread starter student012
  • Start date Start date
  • Tags Tags
    Arm Axis Rotate
AI Thread Summary
The discussion revolves around a homework assignment involving the manipulation of a rectangle in a graphical programming environment. The main tasks include adding an axis to the existing rectangle, drawing both pieces of an arm, and applying specific rotations to the object. The user provides initial code for creating a rectangle, including its dimensions and position, and mentions the need to rotate the first part of the arm by 20 degrees and the second part by -30 degrees about different axes. There is a request for clarification on the instructions, indicating that the user finds them vague and lacks context for the assignment. The conversation highlights the challenges faced in understanding the requirements and executing the graphical transformations correctly.
student012
Messages
2
Reaction score
0
LEASE HELP!

-Add an axis to current rectangle
-Draw both piece of arm
-rotate object first axis 20 degree
--redraw.
-then, rotate 2nd part about 2nd axis to -30degree

my current code for rectangle is
%RECTANGLE('Position', [x y w h])
w=4.5;

%width
h=.5;

%height
x=1.75;y=2.75;

%corner position
xv=[x x+w x+w x x];yv=[y y y+h y+h y];
p1=patch(xv,yv,[0 0 0]);

% original rectangle
T=[-2 -2 -2 -2 -2;-3 -3 -3 -3 -3];
axis equal;
grid on;


R(1,:)=xv;R(2,:)=yv;
p=R+T;

%Translation
alpha=pi/9;
XY=[cos(alpha) -sin(alpha);sin(alpha) cos(alpha)]*p;
Y=patch(p(1,:),p(2,:),'k');
F=patch(XY(1,:),XY(2,:),'k');
T3=[2 2 2 2 2;3 3 3 3 3];
B=XY+T3
y=patch(B(1,:),B(2,:),'k');
 
Physics news on Phys.org
your instructions are vague, is this homework?
 
yes, its my homeowrk..
Tht's the instruction from my teacher.
 
I have no context, so I don't really understand what you're trying to do or what your problem is.
 
Back
Top