matlab - How to normalise a signal to a given peak value -


i using function fread read speech file , using plot(file) plot signal. how normalize peaks +/- 1? cannot find function online.

if want scale peaks belong +/- 1, may apply transformation ensure signal has dynamic range [0,1]:

out = (in - min(in)) / (max(in) - min(in)); 

in , out input , output signals respectively. once have this, can multiply signal 2, subtract result 1 dynamic range +/- 1. because speech signal, 1 dimensional , final code is:

out = 2*( (in - min(in)) / (max(in) - min(in)) ) - 1; 

Comments