Normalising multiple columns of a matrix to a fraction of its maximum value
3 views (last 30 days)
Show older comments
Data: Measurements of a bridge's natural frequencies / eigenfrequencies (master's degree, civil engineering)
1) Data set example (paint):
Notes:
a) f_1, f_2, f_3, f_n => natural frequencies [Hz],
b) a_i, b_i, c_i, n_i => displacement of i-th node / measuring point [mm],
c) there are always 21 measuring points => there are always 21 rows
d) measurements (data sets) are different => n is sometimes 5, sometimes 10, sometimes 15 but I need to analyze all data sets
2) Problem to solve (paint):
Notes:
a) a_i/a_max, b_i/b_max, n_i/n_max => fractions of maximum displacement [mm/mm=no unit]
Comment:
I need to write a code that would remake a matrix consisting of displacement values [mm] so it divides all values by the value's column's maximum value [mm/mm=no unit]. So in each column there should be exactly one number equal to 1,00. I know how to divide a whole matrix by a maximum value (of a matrix or just a row), but I have no idea how to divide each column by a different number. Complicated, I know. I need this for further calculations (comparing experimental and finite element method modal shapes).
Thanks in advance! I hope you liked my Paint talent :)
0 Comments
Accepted Answer
Voss
on 20 May 2024
To divide each column by its maximum value:
data_normalized = data./max(data,[],1);
Example:
data = rand(21,5); % random data
data_normalized = data./max(data,[],1);
disp(data)
disp(data_normalized)
2 Comments
Voss
on 23 May 2024
Edited: Voss
on 23 May 2024
To divide by max of max value and abs(min value), as you describe:
data_normalized = data./max(abs(data),[],1);
But that won't give you values from -1 to 1. If you want that, it would be:
mi = min(data,[],1); ma = max(data,[],1); normalized_data = (data-mi)./(ma-mi)*2-1;
More Answers (1)
See Also
Categories
Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!