フィルターのクリア

error in the process of symbol operation of the matrix

2 ビュー (過去 30 日間)
Asymptote001
Asymptote001 2023 年 5 月 29 日
編集済み: John D'Errico 2023 年 5 月 29 日
It is convenient to use symbol operation to explore the relationship during the multiplication of matrices. And here is my code.
clc;clear;
theta = sym('theta',[1,4])
d = sym('d',[1,4])
a = sym('a',[1,4])
alpha = sym('alpha',[1,4])
T = ones(4,4)
for i = 2:1:4
T = T*[cos(theta(i)) -sin(theta(i)) 0 a(i-1);
sin(theta(i))*cos(alpha(i-1)) cos(theta(i))*cos(alpha(i-1)) -sin(alpha(i-1)) -d(i)*sin(alpha(i-1));
sin(theta(i))*sin(alpha(i-1)) cos(theta(i))*sin(alpha(i-1)) cos(alpha(i-1)) d(i)*cos(alpha(i-1));
0 0 0 1];
end
T
the answer is :
What is wrong with T?

回答 (2 件)

Matt J
Matt J 2023 年 5 月 29 日
編集済み: Matt J 2023 年 5 月 29 日
Nothing is wrong with T, though possibly you didn't scroll down far enough to see the definitions of all the sigmas.
T = 
  1 件のコメント
John D'Errico
John D'Errico 2023 年 5 月 29 日
編集済み: John D'Errico 2023 年 5 月 29 日
I would specuulate the issue is that T ends up as a rank 1 matrix, which it MUST, since T starts out as a rank 1 matrix, as ones(4).

サインインしてコメントする。


John D'Errico
John D'Errico 2023 年 5 月 29 日
編集済み: John D'Errico 2023 年 5 月 29 日
Why do you think there is something wrong with T? We don't know why you wrote this code. It computes what you told MATLAB to compute.
T is displayed there TWICE. The first time it is an array of all ones. A BAD IDEA. I think you wanted T to start as an IDENTITY matrix, not a matrix of all ones.
help eye
EYE Identity matrix. EYE(N) is the N-by-N identity matrix. EYE(M,N) or EYE([M,N]) is an M-by-N matrix with 1's on the diagonal and zeros elsewhere. EYE(SIZE(A)) is the same size as A. EYE with no arguments is the scalar 1. EYE(..., CLASSNAME) is a matrix with ones of class specified by CLASSNAME on the diagonal and zeros elsewhere. EYE(..., 'like', Y) is an identity matrix with the same data type, sparsity, and complexity (real or complex) as the numeric variable Y. Note: The size inputs M and N should be nonnegative integers. Negative integers are treated as 0. Example: x = eye(2,3,'int8'); See also SPEYE, ONES, ZEROS, RAND, RANDN. Documentation for eye doc eye Other uses of eye codistributed/eye codistributor2dbc/eye fixedpoint/eye codistributor1d/eye distributed/eye gpuArray/eye
The point is, if you are looking at this as a sequence of rotations, then you need to start with an identity matrix.

カテゴリ

Help Center および File ExchangeNumber Theory についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by