# I Amplitude decaying sine function

1. Nov 26, 2017

### fog37

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

2. Nov 26, 2017

### Staff: Mentor

min(1,exp(5-x))?

3. Nov 26, 2017

### BvU

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 ?

4. Nov 26, 2017

### fog37

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.

5. Nov 26, 2017

### fog37

Thanks mfb but I don't follow your suggestion: what is min(1,exp (5-x)) supposed to do?

6. Nov 26, 2017

### fog37

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....

7. Nov 26, 2017

### fog37

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!