1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

I Amplitude decaying sine function

  1. Nov 26, 2017 #1

    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?

  2. jcsd
  3. Nov 26, 2017 #2


    User Avatar
    2017 Award

    Staff: Mentor

  4. Nov 26, 2017 #3


    User Avatar
    Science Advisor
    Homework Helper
    2017 Award

    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 ?
  5. Nov 26, 2017 #4
    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.
  6. Nov 26, 2017 #5
    Thanks mfb but I don't follow your suggestion: what is min(1,exp (5-x)) supposed to do?
  7. Nov 26, 2017 #6
    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....
  8. Nov 26, 2017 #7
    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!
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted