general vector code question
이전 댓글 표시
i have the student matlab with simulink and I am trying to code in the vector components such as V = [A*i + B*j + C*k]. When i type this the i hat and j hat components are automatically recognized as imaginary units however the k hat is not recognized and therefore i cannot compute my vector. Is there a way to code in so the k hat is recognized as a imaginary unit such as i hat and j hat?
댓글 수: 2
Ameer Hamza
2020년 4월 16일
i, j, k in vectors are not equivalent to complex numbers. These are basis vectors along x, y, and z-axis. What are you trying to do with this equation? Are you trying to plot something?
random1072
2020년 4월 16일
답변 (2개)
James Tursa
2020년 5월 7일
MATLAB does not support the i, j, k quaternion "complex" numbers. The i and j in MATLAB are strictly the ordinary imaginary numbers.
To use quaternions, unless you have special class code for this, typically you would just represent them as ordinary 4-tuples. E.g.,
q_1 = [MM;A;B;C]
q_2 = [NN,D,E,F];
Then if you want to add them it is simple addition:
q_sum = q_1 + q_2;
Nikhil Sonavane
2020년 5월 19일
0 개 추천
카테고리
도움말 센터 및 File Exchange에서 Quaternion Math에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!