Message Boards Message Boards

GROUPS:

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

Posted 5 days ago
99 Views
|
1 Reply
|
2 Total Likes
|

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

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.

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