home / study / english / communications / questions and answers / need a matlab
ID: 3674225 • Letter: H
Question
home / study / english / communications / questions and answers / need a matlab code to do the following; this problem ...
Question
need a matlab code to do the following;
This problem you turn in. Include your commands (either print the screen or save in an m.file) and your results (numbers or plots.) Add comments to your commands to explain what you are doing.
The figure above shows a robot arm with two motor joints. The lengths are L1 = 4’ and L2 = 3’ (keep the units in feet.) The variables are the joint angles q1 and q2. The equations for the x, y coordinates of the hand are:
x = L1cos q1 + L2cos(q1 + q2)
y = L1sin q1 + L2sin(q1 + q2)
a) Find q1 and q2 to position the hand at x = 6’ and y = 2’. Give the answer in degrees. You should get two solutions (elbow up or elbow down.)
b) We now want to keep x fixed at 6’ and move the hand in a horizontal line. Obtain symbolic solutions for q1 and q2 as functions of y, then evaluate and plot them for y = 0.1 to 3.6’. Use subplot to put the two plots on one page. Remember the angles should be in degrees. Check the point y = 2’ to verify your plot agrees with part a)
Hand 2 Lt Elbow Motor Base MotorExplanation / Answer
.. the call [b,a] = solve(eqns,b,a) assigns the solutions for a assigned to a and the solutions for b assigned to b.
However you probably want to solve, b - [e1 e2 e3]' = 0 for only 3 variables (Let's say q1 q2 q3), you can't solve it for 4 variables, that would be 3 equations and 4 variables which does't make sense.
Since I think that it is related to some mechanical system you may want to solve for only real values. You can either do this solve (eqn, 'Real', true) or declare real values: syms a1 a2 ... real.
However you still wouldn't get a pretty result, unless you use the 'IgnoreAnalyticConstraints'option in this case:
Output
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.