Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #4856
| From | "Christopher O. Young" <cy56@comcast.net> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | DiscretePlot or Plot to get subdivided bars? |
| Date | 2011-09-10 11:30 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <j4fho0$2ff$1@smc.vnet.net> (permalink) |
I'm trying to get bars which will be divided up into unit squares, so I can
illustrate finite differences and their relation to derivatives.
Is there any way to use some special filling directives with DiscretePlot in
order to do this?
The notebook is at http://home.comcast.net/~cy56/DiscretePlotBars.nb and a
picture is at http://home.comcast.net/~cy56/DiscretePlotBars.png.
Maybe the quickest way to do this is to write my own function.
Chris Young
cy56@comcast.net
Manipulate[
Show[
{
Plot[
p[a, b, c, d, x],
{x, Subscript[x, 1], Subscript[x, 2]},
PlotStyle -> Red
],
Plot[
\!\(
\*SubscriptBox[\(\[PartialD]\), \(x\)]\(p[a, b, c, d, x]\)\) //
Evaluate,
{x, Subscript[x, 1], Subscript[x, 2]},
PlotStyle -> Orange
],
DiscretePlot[
p[a, b, c, d, x],
{x, Subscript[x, 1], Subscript[x, 2]},
ExtentSize -> 0.4,
PlotMarkers -> {"Point", Medium},
PlotStyle -> Red,
Filling -> Axis
],
DiscretePlot[
\!\(
\*SubscriptBox[\(\[PartialD]\), \(x\)]\(p[a, b, c, d, x]\)\) //
Evaluate,
{x, Subscript[x, 1] + 0.5, Subscript[x, 2] + 0.5},
ExtentSize -> 0.4,
PlotMarkers -> {"Point", Medium},
PlotStyle -> Orange,
Filling -> Axis
]
},
GridLines -> {Range[Subscript[x, 1], Subscript[x, 2]],
Range[Subscript[y, 1], Subscript[y, 2]]},
GridLinesStyle -> Directive[LightGray, Dashed],
AxesOrigin -> {0, 0},
PlotRange -> {Subscript[y, 1], Subscript[y, 2]},
AspectRatio -> 1
],
{{a, 1}, -4, 4, 1/32},
{{b, 0}, -4, 4, 1/32},
{{c, 0}, -4, 4, 1/32},
{{d, 0}, -4, 4, 1/32},
{{Subscript[x, 1], -4}, -16, 16, 0.5},
{{Subscript[x, 2], 4}, -16, 16, 0.5},
{{Subscript[y, 1], -4}, -16, 16, 0.5},
{{Subscript[y, 2], 4}, -16, 16, 0.5}
]
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
DiscretePlot or Plot to get subdivided bars? "Christopher O. Young" <cy56@comcast.net> - 2011-09-10 11:30 +0000
csiph-web