How to display quaternion number?

Hello,
I want to dispaly a quaternion number as q= 1+2i+3j+4k .But the code is not working.
Here the code;
q=quaternion(1,2,3,4);
this is the error;
Undefined function 'quaternion' for input arguments of type 'double'.
Anybody can help me please?

 Accepted Answer

John Doe
John Doe on 11 Jul 2019
q = quaternion([1 2 3 4])

5 Comments

It also not working.Same error comming.
Both methods work perfectly well for me. According to the documentation quaternion function wasn't implemented until R2018a. What version are you using? This seems to be your problem.
Introduced in R2018a
q=quaternion(1,2,3,4)
q =
quaternion
1 + 2i + 3j + 4k
>> q = quaternion([1 2 3 4])
q =
quaternion
1 + 2i + 3j + 4k
Thank you John.I'm using R2014a version.I think it is the problem.
What are you trying to do?

Sign in to comment.

More Answers (0)

Tags

Asked:

on 11 Jul 2019

Commented:

on 12 Jul 2019

Community Treasure Hunt

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

Start Hunting!