Re: piecewise plot
- To: mathgroup at smc.vnet.net
- Subject: [mg78916] Re: piecewise plot
- From: dh <dh at metrohm.ch>
- Date: Thu, 12 Jul 2007 05:29:00 -0400 (EDT)
- References: <f72b8v$9gl$1@smc.vnet.net>
Hi Jake, you can do this in different ways. Unfortunatly it is not quit clear what you mean by equations. Do you mean functions? Anyway, you can combine your specifications into one single function using Piecewise. Or you can define one function for every interval. What is better depends on what yopu want do. Here is an example for the second solution: f1[x_]:=If[10<x<,1,0]; f2[x_]:=If[30<x<=40,-.5,0]; f3[x_]:=If[50<x<=60,2,0]; Plot[{f1[x],f2[x],f3[x]},{x,0,70},Filling->Axis] hope this helps, Daniel Jake Trexel wrote: > I would like to plot something like this with version 6 > At time 0 to 10 the current is 0, at time 10 to 20 it is 1, time 20 to 30 it > is 0, time 30 to 40 it is -0.5, time 40 to 50 it is 0, then at time 50 to 60 > it is +2. > I would like to break each of these up into something like this eq1:= for 0 > to 10, eq2 := 10 to 20 and so on. Then I want to combine the equations into > a plot. Then I would like to fill in the different sections with different > colors. > I will then go one with another eq. that uses these results and filled in > areas to show how they interact. I will worry about this after my first > question. > Can some one help me? > thanks > Prof. Jake > Former Professor of Mechanical Engineering > >