Normalization of a vector

2 views (last 30 days)
Guido Pastore
Guido Pastore on 18 Mar 2019
Commented: Stephan on 18 Mar 2019
How do I normalize an array of double from -1 and +1?

Accepted Answer

Stephan
Stephan on 18 Mar 2019
Edited: Stephan on 18 Mar 2019
result = normalize(v,'range',[-1 1])
where v is your vector
  2 Comments
Guido Pastore
Guido Pastore on 18 Mar 2019
Thank you so much
Stephan
Stephan on 18 Mar 2019
you may also be interested in:
v = [-2 -1 0; 0.5 1.5 2; 0 2 -1]
result = rescale(v,-1, 1)
which works for arrays. Compare the results of both approaches and choose the option that meets your needs.

Sign in to comment.

More Answers (0)

Categories

Find more on Data Types in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!