I Amplitude decaying sine function

AI Thread Summary
The discussion revolves around plotting a sine function with a decaying amplitude starting at x=5. The user initially struggled with the exponential decay affecting values less than 5. A solution was proposed using the function min(1, exp(5-x)), which effectively keeps the amplitude at 1 for x values between 0 and 5 and allows it to decay for x greater than 5. This approach successfully addresses the user's requirement for a smooth transition in amplitude. The problem was ultimately resolved with this clever mathematical solution.
fog37
Messages
1,566
Reaction score
108
Hello,

I am numerically plotting a sine function sin(x) with amplitude 1 from x=0 to x=15. No problem with that.

The next step gives me problems: I would like the sine function amplitude to decay exponentially starting at x=5 and not before that (the amplitude remains 1). I think I need to multiply the sine function by exp[-(x-5)] to have the amplitude decay starting from x=5. But that alone causes problems with the values less than 5...How should I deal with it?

thanks!
fog37
 
Mathematics news on Phys.org
min(1,exp(5-x))?
 
Hi,
At t=5 you want something mathematically and physically rather drastic to happen. That calls for drastic measures such as IF-statements (or functions derived from those, such as the step function).
Is there a particular language you do this in or is yours more a matehmatics question ?
 
I can use matlab. I just would like the amplitude of the sine way to start decaying at x=5 and remain the same unity value between x=0 and x=4... The decay can be smooth but should start at x=5.

The sole multiplication of sin(x) by the function exp(-0.3*(x-5)) exponentially amplifies the sine function to values larger than 1 in the range x=0 and x=4.
 
Thanks mfb but I don't follow your suggestion: what is min(1,exp (5-x)) supposed to do?
 
By the way, mfb suggestion works fine:

min(1, exp(5-x)) * sin (x)

Makes the sinusoidal function decay start only at x=5 and not earlier than that. I am still not sure what the command min(1, exp(5-x)) does...
 
I get it now. that was clever.

We create a row vector with two elements, i.e. (1, exp(5-x)). The sine amplitude is given by the function min( (1, exp(5-x))) which outputs either the number 1 for x values between 0 and 5, and a value smaller than 1 and equal to exp(5-x) for x>5. Problem solved.

Great. Thanks!
 
Back
Top