function q = Quaternion(x)

    if ischar(x)
        x = lower(x);
        switch x
            case 'i'
                x = [0 1 0 0];
                
            case 'j'
                x = [0 0 1 0];
                
            case 'k'
                x = [0 0 0 1];
        end
    end

    a = x(1);
    
    if numel(x) >= 2
        b = x(2);
    else 
        b = 0;
    end
    
    if numel(x) >= 3
        c = x(3);
    else
        c = 0;
    end
    
    if numel(x) >= 4
        d = x(4);
    else
        d = 0;
    end

    q = [a -b -c -d
         b  a -d  c
         c  d  a -b
         d -c  b  a];
    
end