Line | |
---|
1 | function show(q) |
---|
2 | % SHOW Displays the four components of a quaternion (array). |
---|
3 | % Synonym for displayall(q). |
---|
4 | |
---|
5 | % Copyright © 2005 Stephen J. Sangwine and Nicolas Le Bihan. |
---|
6 | % See the file : Copyright.m for further details. |
---|
7 | |
---|
8 | % We have to duplicate the code here, otherwise when we pass the |
---|
9 | % argument to show, show outputs q = and not the name of the original |
---|
10 | % argument as we require. |
---|
11 | |
---|
12 | % Note, there is no easy way to output a quaternion array in the |
---|
13 | % same format as a complex array, therefore we resort to displaying |
---|
14 | % the s, x, y, z components as real arrays. |
---|
15 | |
---|
16 | disp(' '); |
---|
17 | disp([inputname(1) ' =']); |
---|
18 | disp(' '); |
---|
19 | if ~ispure(q) |
---|
20 | disp(s(q)); |
---|
21 | disp([' + I *']); |
---|
22 | else |
---|
23 | disp([' I *']); |
---|
24 | end |
---|
25 | disp(' '); |
---|
26 | disp(x(q)); |
---|
27 | disp(' + J *'); |
---|
28 | disp(' '); |
---|
29 | disp(y(q)); |
---|
30 | disp(' + K *'); |
---|
31 | disp(' '); |
---|
32 | disp(z(q)); |
---|
Note: See
TracBrowser
for help on using the repository browser.