How to multiply quaternions with symbols

조회 수: 2 (최근 30일)
Chamira Wickramasinghe
Chamira Wickramasinghe 2017년 8월 8일
답변: Chamira Wickramasinghe 2017년 8월 9일
Hi,
I'm trying to multiply two quaternions with 'quatmultiply'.
But one quaternion contains symbols. So matlab gives an error saying "Error using quatmultiply (line 48) Second input elements are not real."
Below is the code I used,
%%
t2 = sym('t2');
Q12 = quatmultiply([cosd(45) 0 0 sind(45)],[cos(t2/2) sin(t2/2) 0 0])
%%
Is there any other way of computing this?
Thanks

답변 (1개)

Chamira Wickramasinghe
Chamira Wickramasinghe 2017년 8월 9일
I found the answer. If anyone having the same issue, when specifying the symbol
instead of typing just,
t=sym('t');
Must type
t=sym('t','real');

Community Treasure Hunt

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

Start Hunting!

Translated by