Line | |
---|
1 | function m = mean(X, dim) |
---|
2 | % MEAN Average or mean value. |
---|
3 | % (Quaternion overloading of standard Matlab function.) |
---|
4 | |
---|
5 | % Copyright © 2005 Stephen J. Sangwine and Nicolas Le Bihan. |
---|
6 | % See the file : Copyright.m for further details. |
---|
7 | |
---|
8 | error(nargchk(1, 2, nargin)), error(nargoutchk(0, 1, nargout)) |
---|
9 | |
---|
10 | if nargin == 1 |
---|
11 | if ispure(X) |
---|
12 | m = quaternion(mean(x(X)), ... |
---|
13 | mean(y(X)), ... |
---|
14 | mean(z(X))); |
---|
15 | else |
---|
16 | m = quaternion(mean(s(X)), mean(v(X))); |
---|
17 | end |
---|
18 | else |
---|
19 | if ispure(X) |
---|
20 | m = quaternion(mean(x(X), dim), ... |
---|
21 | mean(y(X), dim), ... |
---|
22 | mean(z(X), dim)); |
---|
23 | else |
---|
24 | m = quaternion(mean(s(X), dim), mean(v(X), dim)); |
---|
25 | end |
---|
26 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.