How do i normalize a signal so that it's maximum is 1?
39 次查看(过去 30 天)
显示 更早的评论
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 个评论
Paul
2021-11-9
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.
回答(1 个)
Sulaymon Eshkabilov
2021-11-9
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';
0 个评论
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!