Normalize N-D Vectors in Single Matrix or N Component Matrices

Normalizes N-D vectors provided either in one matrix, or as multiple component matrices.

이 제출물을 팔로우합니다

NORMVEC normalize vector(s).
NORMVEC computes the unit vectors in the direction of the vectors
provided. It can process two types of arguments:

1) single matrix of vectors
2) multiple matrices of vector components
(as those returned by MESHGRID and NDGRID)

In both cases, the p-norm to be used can be specified.
The default is the 2-norm (Euclidean).

Only in the first case, the matrix dimension along which the vectors
are defined can be defined. The default is the first non-singleton
This behavior is derived from VNORM (FEX id=#10708, by Winston Smith),
which is called by this function.

Zero vectors are normalized to 0 and NOT to NaN.

usage

Case A: matrix of N-dimensional column vectors
[v] = NORMVEC(v)
[v] = NORMVEC(v, 'p', n)
[v] = NORMVEC(v, 'p', n, 'dim', d)

v = matrix of column vectors
= [#dimensions x #vectors]
n = p-norm selected (e.g. 2 is the Euclidean norm ||.||_2)
d = norm for vectors defined along dimension d of matrix v
>= 1
or [] (vectors along first non-singleton dimension)

Case B: 2 component matrices of 2-dimensional vectors
[px, py] = NORMVEC(px, py)
[px, py] = NORMVEC(px, py, 'p', n)

px = matrix [M x N] of x vector components
py = matrix [M x N] of y vector components
n = 'p' norm selected

Case C: 3 component matrices of 3-dimensional vectors
[px, py, pz] = NORMVEC(px, py, pz)
[px, py, pz] = NORMVEC(px, py, pz, 'p', n)

px = matrix [M x N x L] of x vector components
py = matrix [M x N x L] of y vector components
pz = matrix [M x N x L] of z vector components
n = 'p' norm selected

Case D: N component matrices of N-dimensional vectors
[px1, px2, ..., pxN] = NORMVEC(px1, px2, ..., pxN)
[px1, px2, ..., pxN] = NORMVEC(px1, px2, ..., pxN, 'p', n)

pxi = matrix [M1 x M2 x ... x MN] of xi vector components
n = 'p' norm selected

dependency (included)
vnorm, File Exchange ID = 10708, (c) 2006 by Winston Smith
http://www.mathworks.com/matlabcentral/fileexchange/10708-vector-norm

인용 양식

Ioannis Filippidis (2026). Normalize N-D Vectors in Single Matrix or N Component Matrices (https://kr.mathworks.com/matlabcentral/fileexchange/36248-normalize-n-d-vectors-in-single-matrix-or-n-component-matrices), MATLAB Central File Exchange. 검색 날짜: .

카테고리

Help CenterMATLAB Answers에서 Splines에 대해 자세히 알아보기

일반 정보

MATLAB 릴리스 호환 정보

  • 모든 릴리스와 호환

플랫폼 호환성

  • Windows
  • macOS
  • Linux
버전 퍼블리시됨 릴리스 정보 Action
1.0.0.0