MATLAB: How to normalize a matrix such that the maximum value is 1

normalize

I have 2 matrices. I plot them against a common x-axis
.
Now I like to normalize both signal such that the largest peak of each signal is 1 so that I can compare the signals.
How should I go about doing it?

Best Answer

If you have Image Processing Toolbox
new_y1=mat2gray(y1);
new_y2=mat2gray(y2);
% new_y1 and new_y2 have both the same minimum equal to 0 and maximum equal to 1