1 function mag = vecmag(vec)
3 % VECMAG: Magnitude of the vectors.
11 % vec : An array of column vectors represented by a matrix of
12 % size (dim,nv), where is the dimension of the vector and
13 % nv the number of vectors.
17 % mvec : Magnitude of the vectors, vector of size (1,nv).
21 % Determines the magnitude of the vectors.
25 % Find the magnitude of the two vectors (0.0,2.0,1.3) and (1.5,3.4,2.3)
27 % mvec = vecmag([0.0 1.5; 2.0 3.4; 1.3 2.3]);
29 % Copyright (C) 2000 Mark Spink
31 % This program is free software: you can redistribute it and/or modify
32 % it under the terms of the GNU General Public License as published by
33 % the Free Software Foundation, either version 2 of the License, or
34 % (at your option) any later version.
36 % This program is distributed in the hope that it will be useful,
37 % but WITHOUT ANY WARRANTY; without even the implied warranty of
38 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39 % GNU General Public License for more details.
41 % You should have received a copy of the GNU General Public License
42 % along with this program. If not, see <http://www.gnu.org/licenses/>.
44 mag = sqrt(sum(vec.^2));