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

28 views (last 30 days)
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.
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.

Sign in to comment.

Answers (1)

Sulaymon Eshkabilov
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;
plot(t,S), title('Original Signal'), grid on
SM = max(S);
SN = S/SM(1);
plot(t, SN), grid on; title 'Normalized Signal';



Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!