I have a homework question that I cannot answer. Here is the question prompt:
Equations 8.3 and 8.4 are:
(8.3)
(8.4)
where
Here is the function I wrote:
function F = rob_arm (alphag, betag)
F = (1).*cos(alphag)+ (1).*(cos(alphag+betag))-(1) ;
(1).*sin(alphag) + (1).*(sin(alphag+betag))-(1.1) ;
end
Because alpha
and beta
are matrices of different sizes, I used meshgrid
to create alphag
and betag
, and used those matrices to calculate the values of rob_arm
. After four hours of messing with this, I'm not even sure what the question is asking anymore, and the TA's are not currently answering emails. I wrote the following code, to try and force rob_arm
into a single column:
alpha = 0:pi/100:(pi/2); %define angle alpha
beta = 0:pi/100:pi; %define angle beta
[alphag, betag] = meshgrid (alpha, beta); %mesh grid alpha and beta b/c different matrix dimensions
arm_pos = rob_arm (alphag, betag);
for ii = 1:1:101
for k = 1:1:51
col_vec (1,1:1:5151) = arm_pos(ii,k);
end
end
Ignoring the query to create a column vector, the resulting output, arm_pos
is good output. I can graph it and I get a very pretty picture of all the possible points that this robot arm can 'reach.'
But because I am dumb and have been trying this for many hours, it's not saving successive values of rob_arm
into col_vec
, it just replaces it each time and I end up with a 1x1 matrix. Ultimately, the goal will be to use the Newton-Raphson method to determine the zeroes of this function, but that's a long ways off. I am thinking if I can get all of the values calculated by rob_arm
into a single column, then I can answer this question.
The next question is:
Which I will need to ask for clarification on, because I don't understand how a 1 x 51 matrix ( alpha
) and a 1 x 102 matrix ( beta
) could be accepted into a single row vector, that would then output a 2x2 matrix. I know what the Jacobian is, and it is the partial derivitives of my two functions, not a matrix of values.
If anyone wants to give me a hand, that would be super awesome.
You function definition is not right, you should use something like
function F = rob_arm (alphag, betag)
F = [(1).*cos(alphag)+ (1).*(cos(alphag+betag))-(1) ; ...
(1).*sin(alphag) + (1).*(sin(alphag+betag))-(1.1)];
end
Without the three dots " ... " MATLAB performs this calculation
(1).*sin(alphag) + (1).*(sin(alphag+betag))-(1.1);
but does nothing with the result, and returns
F = (1).*cos(alphag)+ (1).*(cos(alphag+betag))-(1) ;
which is not what you want, half the F values are missing.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.