Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

2 Answers 2

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}]

plot

share|improve this answer
    
@m_goldberg - Thanks, one day I will figure out how to do that :) –  Ymareth Mar 26 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 at 14:32
    
Still don't understand. You have "sent" in your code which you have not defined. –  Ymareth Mar 26 at 14:45
    
sorry I meant sin[t].. –  Salvatore Calabrese Mar 26 at 14:53

Your Answer

 
discard

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.