4
$\begingroup$

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!

$\endgroup$
0

1 Answer 1

8
$\begingroup$
x0 = First[x /. Solve[2 10^5 x == 10]] 

1/20000

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.

$\endgroup$
2
  • 2
    $\begingroup$ Oh that's brilliant. Totally forgot about piecewise functions. Thanks so much! $\endgroup$ Commented Sep 10, 2016 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$ Commented Sep 10, 2016 at 22:10

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.