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.

I have a function $Eb1$ which was the subject of a question I asked recently - you can see it here on stack exchange. Now, in that example it's specified between a boundary $r_n$ and $r_o$ where $r_o > r_n $ and it works as expected. I also want to specify the value of the function between 0 and $r_n$ - fcor all $r < r_n $, the function is a constant with the value $Eb1(r_n)$, so the same value it is at the boundary. I am however unsure how to code this, and how to combine these two specifications into a single expression.

I was considering using piece-wise, but I am unclear about how to specify this and so far my attempts have failed. Any ideas?

share|improve this question

1 Answer 1

I've actually managed to answer it myself - will answer here if it's any good to others;

Ebound[r_] = 
  Piecewise[{{Eb1[rn, 14400] /. x, r < rn}, {Eb1[r, 14400] /. x, 
 r > 0}}];

Plot[Ebound[r], {r, 0, ro}, PlotRange -> Automatic]

this gives the expected behaviour;

enter image description here

share|improve this answer

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.