0
|
15047 Views
|
5 Replies
|
0 Total Likes
View groups...
Share
GROUPS:

# Piecewise plot vertical line

Posted 11 years ago
 Hi, I'm intending to plot a piecewise fuction. The horizontol lines displays correctly. How can I plot the vertical line connecting 20 and -60 @ x=6    and  -60to0 at X=8  g[x_] := \[Piecewise] {     {20, x < 6},     {-60, 6 < x < 8},     {0, True}   }Plot[g[x], {x, 0, 10}]
5 Replies
Sort By:
Posted 11 years ago
 Strange. I tried the same code from a different machine and now it displays the verticle lines as expected.
Posted 10 years ago
 I tried this on Mathematica 8.0.4 on a Mac and it shows the same problem (missing vertical lines at x={60,80} also.What version and OS did you have your problem and successes on?
Posted 10 years ago
 You can try giving explicit Exclusions: Plot[g[x], {x, 0, 10}, Exclusions -> {x == 6, x == 8}, ExclusionsStyle -> Red] On my system (Mma version 10) I get the vertical lines also with this: Plot[g[x], {x, 0, 10}, ExclusionsStyle -> Red] 
Posted 10 years ago
 Just add the option to the plot: Exclusions -> None
Posted 10 years ago
 g[x_] := \[Piecewise]{{20, x < 6}, {-60, 6 < x < 8}, {0, True}} Plot[g[x], {x, 0, 10}, Exclusions -> None]