Home > published > mag.m

mag

PURPOSE ^

mag returns the magnitude of a row vector

SYNOPSIS ^

function [ magnitude ] = mag( vector )

DESCRIPTION ^

mag returns the magnitude of a row vector

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

function [ magnitude ] = mag( vector )
%mag returns the magnitude of a row vector
sz=size(vector);
if min(sz>1) error('Trying to take the magnitude of a matrix'); end
if sz(1)==1 magnitude=sqrt(vector*vector'); end
if sz(2)==1 magnitude=sqrt(vector'*vector); end

Generated on Fri 07-Nov-2008 13:46:59 by m2html © 2005