How to create a sine wave with linear increasing amplitude transition

4 views (last 30 days)
Hello everybody,
I would like to create a sine wave with linear increasing amplitude (Amp1 to Amp2), characteristics mentioned above:
Total duration: 9sec
Amplitude1: 0.3
Transition start time: 4th sec
Transition duration: 300ms
Amplitude2: 0.6
Thnx :)

Accepted Answer

Russel Burgess
Russel Burgess on 14 Mar 2021
One way:
t = linspace(0, 9, 10000); % s
f = 10; % Hz
A = 0.3.*(t<4) + (0.3 + (0.6 - 0.3)/0.3*(t-4)).*(t>=4 & t<4.3) + 0.6*(t>=4.3);
x = A.*sin(2.*pi.*f.*t);
plot(t, x);

More Answers (0)

Community Treasure Hunt

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

Start Hunting!