Normalization of a matrix to a particular value

조회 수: 1 (최근 30일)
rihab
rihab 2015년 10월 19일
답변: Guillaume 2015년 10월 19일
I have a 12x4 matrix with four of its elements having value of 1 and with remaining elements having value less than 1. I want to normalize in it a way that the elements corresponding to 1 have value of 0.125 and the remaining elements are less than 0.125. I am normalizing it as follows:
a = a .* sqrt(0.125); %a is 12x4 matrix
However, the elements corresponding to 1 are still not 0.125. I would be thankful if anyone has any idea on this kind of normalization problem.

채택된 답변

Guillaume
Guillaume 2015년 10월 19일
a = a .* sqrt(0.125); However, the elements corresponding to 1 are still not 0.125.
I predict that your elements corresponding to 1 are exactly equal to sqrt(0.125). If you want them to be 0.125, then multiply them by 0.125 not its square root.
a = a .* 0.125;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by