# How do i normalize a signal so that it's maximum is 1?

66 views (last 30 days)
Hamza Ali on 9 Nov 2021
Commented: Paul on 9 Nov 2021
I know to do this all I would have to do is find the maximum value for the whole duration of the signal, and then divide the signal by this value. However, I'm having trouble capturing the maximum value signal as a constant value. When I tried using the running max block this didn't work correctly because the running max changes over time. Also, the normal max block simply outputs whatever signal is put into it, which isn't helpful.
Any help is appreciated.
##### 3 CommentsShow 1 older commentHide 1 older comment
Hamza Ali on 9 Nov 2021
@Paul The only requirement I have is to normalize the signal so that the maximum value of the signal equals 1. I'm not sure if this normalization can occur while the simulation is occuring, but if it can that's fine.
And to your second point I'm trying to normalize a signal with randomly generated white noise added to it. Maybe it's somehow possible to get the maximum over 99% of the simulation duration. This will leave some time left over to divide the overall signal by this maximum value, which will give you a signal that is most likely normalized to have a maximum value of 1. Is there a way to grab this maximum value at a certain time of the simulation, possibly using the running max block and some type of a hold block?
Paul on 9 Nov 2021
The problem statement is still unclear to me.
It sounds like you're running a model in Simulink. Is that correct?
If so, I don't understand what the goal is.
Do you want to wait until after the simulation completes and then normalize a signal that's been collected from the simulation, perhaps for plotting purposes? Of course, this won't change the actual results of the simulation.
Or, are you trying to manipulate a signal while the simulation is running? In which case much more clarity is needed on what you're trying to do, because at any instant in time the simulation can only modify the signal at that instant; it can't change anything that was computed in the past.

Sulaymon Eshkabilov on 9 Nov 2021
t=linspace(0, 2, 1e3);
f1 = 5;
f2 = 10;
S = cos(2*pi*f1*t)+sin(2*pi*f2*t)+rand(size(t))/5;
subplot(211)
plot(t,S), title('Original Signal'), grid on
SM = max(S);
SN = S/SM(1);
subplot(212)
plot(t, SN), grid on; title 'Normalized Signal';

### Categories

Find more on Spectral Analysis 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!