I am attempting to draw a graph with a slope of 200,000 that becomes "saturated" at $y= \pm 10$. Essentially, the graph is of the form $y=200000x$. However, I have been unsuccessful in getting it to level off at the y bounds. I want the graph to become a horizontal straight lines at those values, like this, where my A would be 200000 and my Vcc values would be $\pm 10$:

from a random website

Thank you!

x0 = First[x /. Solve[2 10^5 x == 10]]


y[x_] := Piecewise[{{2 10^5 x, -x0 < x < x0}, {10, x >= x0}, {-10, x <= x0}}]

plot = Plot[y[x], {x, -2 x0, 2 x0}, Frame -> True]

enter image description here

Or in another way, using Clip as requested by C. E.:

Plot[Clip[200000 x, {-10, 10}], {x, -2 x0, 2 x0}, Frame -> True]

which gives the same plot as above.

| improve this answer | |
  • 2
    $\begingroup$ Oh that's brilliant. Totally forgot about piecewise functions. Thanks so much! $\endgroup$ – tyler a Sep 10 '16 at 22:01
  • 2
    $\begingroup$ Since you've answered this question and it has already been accepted, would you mind also writing about Clip? $\endgroup$ – C. E. Sep 10 '16 at 22:10

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.