ROTQR2QC converts a matrix of real quaternion vectors into complex form Inputs: QR(4m,...) array of real-valued quaternions Outputs: QC(2m,...) array of complex-valued quaternions The real-valued quaternion [r a b c]' becomes [r+j*b a+j*c]'

0001 function qc=rotqr2qc(qr) 0002 %ROTQR2QC converts a matrix of real quaternion vectors into complex form 0003 % 0004 % Inputs: 0005 % 0006 % QR(4m,...) array of real-valued quaternions 0007 % 0008 % Outputs: 0009 % 0010 % QC(2m,...) array of complex-valued quaternions 0011 % 0012 % The real-valued quaternion [r a b c]' becomes [r+j*b a+j*c]' 0013 0014 % 0015 % Copyright (C) Mike Brookes 2000-2012 0016 % Version: $Id: rotqr2qc.m 1616 2012-03-15 09:13:31Z dmb $ 0017 % 0018 % VOICEBOX is a MATLAB toolbox for speech processing. 0019 % Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html 0020 % 0021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0022 % This program is free software; you can redistribute it and/or modify 0023 % it under the terms of the GNU General Public License as published by 0024 % the Free Software Foundation; either version 2 of the License, or 0025 % (at your option) any later version. 0026 % 0027 % This program is distributed in the hope that it will be useful, 0028 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0029 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0030 % GNU General Public License for more details. 0031 % 0032 % You can obtain a copy of the GNU General Public License from 0033 % http://www.gnu.org/copyleft/gpl.html or by writing to 0034 % Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA. 0035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0036 persistent a b 0037 if isempty(a) 0038 a=[1 3 2 4]; 0039 b=[1 1i]; 0040 end 0041 s=size(qr); 0042 qq=reshape(qr,4,[]); 0043 s(1)=s(1)/2; 0044 qc=reshape(b*reshape(qq(a,:),2,[]),s);

Generated on Tue 10-Oct-2017 08:30:10 by