Re: Plot-Function
- To: mathgroup at smc.vnet.net
- Subject: [mg31166] Re: [mg31158] Plot-Function
- From: BobHanlon at aol.com
- Date: Tue, 16 Oct 2001 01:18:41 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 2001/10/14 4:59:54 AM, mav at justmail.de writes:
>in Mathematica,
>I've got two functions (f1 and f2).
>
>
>Is it possible to plot the first function (f1) from x = 0 to 3 and the
>second
>one from x = 3 to 6 in _one_ Graphic?
>
Needs["Graphics`Graphics`"];
Needs["Graphics`Colors`"];
f1[x_] := x^2;
f2[x_] := 12-x;
Plot[f1[x]-UnitStep[x-3]*(f1[x]-f2[x]),
{x,0,6}, PlotStyle ->
{AbsoluteThickness[2], Red},
Epilog->{Text["f1",{2,f1[2]},{1,-1}],
Text["f2",{4.5,f2[4.5]},{-1,-1}]}];
DisplayTogether[
Plot[f1[x], {x,0,3}, PlotStyle ->
{AbsoluteThickness[2], Blue},
Epilog->{Text["f1",{2,f1[2]},{1,-1}],
Text["f2",{4.5,f2[4.5]},{-1,-1}]}],
Plot[f2[x], {x,3,6}, PlotStyle ->
{AbsoluteThickness[2],Red}]];
Bob Hanlon
Chantilly, VA USA