Search code examples
javamatlabquaternions

Single value for a quaternion


Quaternions are of the form q = w + x*i + y*j + z*k where i, j & k are the vectors which represent dimensions and w is the scalar. Given 4 values that represent the w, x, y, z components, I need to find the value of q.

I have looked through many MATLAB functions but most of them deal with quaternion multiplication, normalization etc. Can anyone please tell me how I can find a single value q for a given quaternion?


Solution

  • (w,x,y,z) is the value of the quaternion.

    When you say a single value for q - do you mean the norm of the quaternion? In this case the norm is:

    Math.sqrt(w*w+x*x+y*y+z*z).