Normalising multiple columns of a matrix to a fraction of its maximum value
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Voss
2024-5-20
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 个评论
Voss
2024-5-23
编辑:Voss
2024-5-23
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;
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!