Message Boards Message Boards

0
|
2063 Views
|
1 Reply
|
2 Total Likes
View groups...
Share
Share this post:

Make a continuous plot and fill closed ranges for shear diagram?

Posted 3 years ago

This is a shear diagram for beams. Thank you so much in advance.

Show[Plot[40 - 6 x, {x, 0, 3}], Plot[12 - 6 x, {x, 3, 8}], 
 Plot[60 - 6 x, {x, 8, 10}], PlotRange -> All, 
 AxesOrigin -> Automatic]

enter image description here

POSTED BY: Gustavo Tena

I would use Piecewise:

f[x_] := Piecewise[{{40 - 6 x, 0 <= x < 3}, {12 - 6 x, 
     3 <= x < 8}, {60 - 6 x, 8 <= x <= 10}}];
Plot[f[x], {x, 0, 10}, Filling -> Axis]
Plot[f[x], {x, 0, 10}, Exclusions -> Automatic, 
 ExclusionsStyle -> Directive[Red, Dashed]]
Show[%, %%]

Curiously, I could not combine Exclusions with Filling in a single Plot command.

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract