matlab - Take an array and transform its values to have a new minimum and maximum -
matlab - Take an array and transform its values to have a new minimum and maximum -
i have array of info in column length 354717. values vary between 12.8 (min.) , 64.2 (max.).
i want create array of same size values of min.= 2.7 , max.= 27.
any suggestions?
you can first normalize info dynamic range falls between [0,1]. 1 time this, can multiply values 27 - 2.7 = 24.3, offset 2.7 values between [2.7, 27]. in other words, if array called a, this:
norma = (a - min(a)) / (max(a) - min(a)); %// normalize [0,1]. out = 24.3*norma + 2.7; %// alter [2.7, 27] in general, if want info within range, first normalize info in first line of code, this:
out = (maxd - mind)*norma + mind; remember, norma normalized info falls between [0,1]. mind , maxd minimum , maximum values of desired range want. case, mind = 2.7 , maxd = 27.
good luck!
arrays matlab interpolation
Comments
Post a Comment