1
$\begingroup$

I have a function as defined below:

y[x_] := 9*10^-9*(Exp[x/(2*23*10^-3)] - 1)

I am trying to plot this function for the range -40<=x<0.7, but in the range [-40,0], the function has very small values so they are not visible when displayed with the values in the interval [0,0.7].

Actually, I want to put 10^-9 order of magnitude for y[x]<=0 corresponding to x<=0, and 10^-3 for 0<=y[x] which corresponding to 0<=x<0.7.

I'd also like to make the ticks on the positive y axis display whole numbers 1, 2, 3, .... and scale them by a factor of 10^-3.

$\endgroup$
2
$\begingroup$
Module[{f, p1, p2, opts, labels, nlist}, 
 f[x_] := 9*10^-9*(Exp[x/(2*23*10^-3)] - 1);
 opts = {Frame -> True, AxesOrigin -> {0, 0}, 
         FrameTicks -> {{labels, None}, {Automatic, None}}};
 nlist = Range[-2*^-8, 0, 0.5*^-8];
 labels = 
  Riffle[nlist, 
    StringJoin[ToString[#], 
       "*\!\(\*SuperscriptBox[\(10\), \(-9\)]\)"] & /@ 
     Round[10*^9 nlist]]~Partition~2;
 p1 = Plot[f[x], {x, -40, -2}, Evaluate@opts];
 nlist = Range[0, 0.001, 0.0001];
 labels = 
  Riffle[nlist, 
    StringJoin[ToString[#], 
       "*\!\(\*SuperscriptBox[\(10\), \(-3\)]\)"] & /@ 
     Round[10*^3 nlist]]~Partition~2;
 p2 = Plot[f[x], {x, -2, 1}, Evaluate@opts];
 GraphicsGrid[{{p1, p2}}]]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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