Re: Drawing function with 3 variables in a graph
- To: mathgroup at smc.vnet.net
- Subject: [mg71850] Re: Drawing function with 3 variables in a graph
- From: dh <dh at metrohm.ch>
- Date: Fri, 1 Dec 2006 06:21:52 -0500 (EST)
- References: <ekmefu$8hs$1@smc.vnet.net>
Hi, simply define a function of 3 variables. E.g. g[x_] := Sin[x]; f[t_, a_, m_] := Exp[m g[a] t]; Plot[Evaluate[Table[f[t, a,m], {m, 0, 1, .25}, {a, 1, 3, 1}]], {t, 0,1}, PlotStyle -> Table[Hue[m a/4.], {m, 0, 1, .25}, {a, 1, 3, 1}]] If you have too many functions in your plot, GraphicsArray or StackGraphics may come in handy. E.g StackGraphics: << Graphics`Graphics3D` g[x_] := Sin[x]; f[t_, a_, m_] := Exp[m g[a] t]; g0 = {}; Do[AppendTo[g0, Plot[Evaluate[Table[f[t, a, m], {a, 1, 3, 1}]], {t, 0, 1}, PlotStyle -> Table[Hue[a/4.], {a, 1, 3, 1}]]] , {m, 0, 1, .25}]; Show[StackGraphics[g0]] Daniel royend at gmail.com wrote: > I want to draw a fairly complex function several times in one graph. By > using different colour I hope to present the development of my function > as the three variables changes. > > Earlier I have managed two variabels by using this: > Plot[Evaluate[ { Table[ f[t,m], {m,0,5}] } ], {t,-20,20}, > PlotStyle->etc] > > But this time I have met difficulties because one of my variables are > "hidden" inside the function f(t,m), like this: > g(a) = a/2 > f(t) = m*g(a)^t > m,a and t are variables. > > Therefore I need to control 3 variables and have tried this: > With[ {a=5}, Plot[ same as above].... > > I have read some about lists, graphics and so on but still haven't been > able to find any solution. > Do you have any tips for solving this? >