Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I plot a stepwise function like f[a, t] = 10 Exp[-0.1 Sin[t]] for a > t and f[a, t] = f[a, t - 1] Exp[-0.1 a] for a < t? If you see, for a < t, the function f[a, t] dependes on a previous value of itself.

share|improve this question

Two defintions of f, one each side of a.

f[a_?NumericQ, t_?NumericQ] /; a > t := 10 Exp[-0.1 Sin[t]];
f[a_?NumericQ, t_?NumericQ] /; a <= t := f[a, t - 1] Exp[-0.1 a];

Plot it.

Plot[f[5, t], {t, 0, 10}]


share|improve this answer
@m_goldberg - Thanks, one day I will figure out how to do that :) – Ymareth Mar 26 '14 at 15:12

I can't understand your question, what is "sent" etc. but try this for a starting point

Manipulate[Plot[Piecewise[{{1 + 3 a, a <= t}, {10 Exp[-0.1 a*20], a > t}}], {a, 0, 2}], {t, 0, 2}]
share|improve this answer
Sorry..the question was:How can I plot a stepwise function like f[a,t]= 10exp(-0.1sent) for a>t, f[a,t-1]exp(-0.1a) for a<t....if you see for a<t the function depends on the previous value of the function f[a,t]. – Salvatore Calabrese Mar 26 '14 at 14:32
Still don't understand. You have "sent" in your code which you have not defined. – Ymareth Mar 26 '14 at 14:45
sorry I meant sin[t].. – Salvatore Calabrese Mar 26 '14 at 14:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.