How to multiply quaternions with symbols

18 views (last 30 days)
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

Answers (1)

Chamira Wickramasinghe
Chamira Wickramasinghe on 9 Aug 2017
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!