Take a vector and convert it to a unit vector (normalize)

normalize a vector to a unit vector

現在この提出コンテンツをフォロー中です。

This function will take a [1xn] or [mx1] vector and normalize it to a unit vector length.

To use this function [vectorOut] = fcn_createUnitVector(vectorIn)

Error checking is performed to test for NaN values in the output, and a square root of the sum of the squares == 1

This function will take column or row vectors and output in said format.

引用

James West (2026). Take a vector and convert it to a unit vector (normalize) (https://jp.mathworks.com/matlabcentral/fileexchange/28605-take-a-vector-and-convert-it-to-a-unit-vector-normalize), MATLAB Central File Exchange. に取得済み.

謝辞

ヒントを与えたファイル: Normalize N-D Vectors in Single Matrix or N Component Matrices

一般的な情報

MATLAB リリースの互換性

  • すべてのリリースと互換性あり

プラットフォームの互換性

  • Windows
  • macOS
  • Linux
バージョン 公開済み リリース ノート Action
1.3.0.0

Added error checking
Added output format equal to input format
Added ability to handle multi-dimensional arrays.

1.2.0.0

Changed the code to operate in n dimensions.
It will now transform your vector back to its original notation
Error checking is now done to detect irregular calculations, and NaN values in the output
Changed the name to be more accessible.

1.0.0.0