Vector norm

バージョン 1.0.0.0 (895 Bytes) 作成者: Winston Smith
Returns the vector norm for a specified dimension (e.g. row/col) of a matrix
ダウンロード: 2.4K
更新 2006/4/26

ライセンスがありません

% VNORM - Return the vector norm along specified dimension of A
%
% VNORM(A) returns the 2-norm along the first non-singleton
% dimension of A
% VNORM(A,dim) return the 2-norm along the dimension 'dim'
% VNORM(A,dim,normtype) returns the norm specified by normtype
% along the dimension 'dim'
% VNORM(A,[],normtype) returns the norm specified by normtype along
% the first non-singleton dimension of A
%
% normtype may be one of {inf,-inf,positive integer}.
% For a given vector, v, these norms are defined as
% inf: max(abs(v))
% -inf: min(abs(v))
% p (where p is a positive integer): sum(abs(v).^p)^(1/p)
%
% Examples:
% A = [8 1 6; 3 5 7; 4 -9 2];
%
% %Columnwise 2-norm (Euclidean norm)
% vnorm(A,1) = [9.4340 10.3441 9.4340];
% vnorm(A,[],2) % Same as above (since first non-singleton dimensions
% % is columnwise and default norm is 2-norm.
% vnorm(A,[],[])% Again, same as above
%
% % Row-wise maximum of absolute values
% vnorm(A,2,inf) = [8 7 9]';
%
% % Columnwise minimum of absolute values
% vnorm(A,[],-inf) = [3 1 2];
%
% % Error: Use the inf type and not the string 'inf'
% vnorm(A,[],'inf') % Wrong
% vnorm(A,[],inf) % Correct

引用

Winston Smith (2024). Vector norm (https://www.mathworks.com/matlabcentral/fileexchange/10708-vector-norm), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R14SP3
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersSparse Matrices についてさらに検索
タグ タグを追加

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
1.0.0.0

Improved help with examples and special cased the 1-norm.