[Date Index]
[Thread Index]
[Author Index]
Re: Plotting in a dynamic environment.
*To*: mathgroup at smc.vnet.net
*Subject*: [mg99647] Re: Plotting in a dynamic environment.
*From*: Helen Read <hpr at together.net>
*Date*: Sun, 10 May 2009 05:15:55 -0400 (EDT)
*References*: <gu3at0$t8t$1@smc.vnet.net>
*Reply-to*: HPR <read at math.uvm.edu>
mgoic wrote:
> Hi everyone,
>
> I am having problems when trying to plot an expression in a Dynamic
> model using manipulate tool. For example, in this simple code I can
> plot the function (first plot), I can evaluate its value in a
> manipulate environment (second plot), but when trying to plot in a
> dynamic environment I just get empty axis (third plot).
>
> myfun = x^2 + 3 t x ;
> t = 1;
> Plot[myfun, {x, 0, 2}]
> Clear[t]
> Manipulate[Evaluate[myfun], {x, 1, 2}, {{t, 1}, 0, 10}]
> Manipulate[Plot[Evaluate[myfun], {x, 1, 2}], {{t, 1}, 0, 10}]
>
> Any idea of what I am doing wrong? I will really appreciate any
> guidance.
You need to define your function *as a function* of x and t.
f[x_, t_] := x^2 + 3 t x
Manipulate[Plot[f[x, t], {x, 1, 2}], {{t, 1}, 0, 10}]
I'd also suggest setting a PlotRange so that the plot doesn't jerk
around when you Manipulate t. For instance:
Manipulate[Plot[f[x, t], {x, -10, 10}, PlotRange -> {{-10, 10}, {-50,
50}}], {t, 0, 10}]
--
Helen Read
University of Vermont
Prev by Date:
**Re: Manipulate Issue - resend with code**
Next by Date:
**Re: Plotting in a dynamic environment.**
Previous by thread:
**Re: Plotting in a dynamic environment.**
Next by thread:
**Re: Plotting in a dynamic environment.**
| |