Home > voicebox > rotqrvec.m

# rotqrvec

## PURPOSE

ROTQRVEC applies a quaternion rotation ot a vector array y=[q,x]

## SYNOPSIS

function y=rotqrvec(q,x)

## DESCRIPTION

```ROTQRVEC applies a quaternion rotation ot a vector array y=[q,x]

Inputs:   q(4,1)    quaternion rotation (possibly unnormalized)
x(3n,...) array of 3D column vectors

Outputs:  y(3n,...) array of 3D column vectors```

## CROSS-REFERENCE INFORMATION

This function calls:
• rotqr2ro ROTQR2RO converts a real quaternion to a 3x3 rotation matrix
This function is called by:

## SOURCE CODE

```0001 function y=rotqrvec(q,x)
0002 %ROTQRVEC applies a quaternion rotation ot a vector array y=[q,x]
0003 %
0004 % Inputs:   q(4,1)    quaternion rotation (possibly unnormalized)
0005 %           x(3n,...) array of 3D column vectors
0006 %
0007 % Outputs:  y(3n,...) array of 3D column vectors
0008
0009 %      Copyright (C) Mike Brookes 2011-2012
0010 %      Version: \$Id: rotqrvec.m 1640 2012-03-16 07:43:08Z dmb \$
0011 %
0012 %   VOICEBOX is a MATLAB toolbox for speech processing.
0014 %
0015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0016 %   This program is free software; you can redistribute it and/or modify
0017 %   it under the terms of the GNU General Public License as published by
0018 %   the Free Software Foundation; either version 2 of the License, or
0019 %   (at your option) any later version.
0020 %
0021 %   This program is distributed in the hope that it will be useful,
0022 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0023 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0024 %   GNU General Public License for more details.
0025 %
0026 %   You can obtain a copy of the GNU General Public License from
0027 %   http://www.gnu.org/copyleft/gpl.html or by writing to
0028 %   Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
0029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0030 s=size(x);
0031 y=reshape(rotqr2ro(q)*reshape(x,3,[]),s);```

Generated on Mon 06-Aug-2018 14:48:32 by m2html © 2003