Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: manipulate time

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114771] Re: manipulate time
  • From: Peter Breitfeld <phbrf at t-online.de>
  • Date: Thu, 16 Dec 2010 05:50:47 -0500 (EST)
  • References: <ieadlm$ra7$1@smc.vnet.net>

manel zerelli wrote:

> i want to solve two differential equations in which a parameter "r"
> vary in an intervall. for that i want to see the effect of this
> variation at each time.i want to manipulate time and for each instant
> i scan all the interval of variation of parameter "r".
> i tried this:
>
> Manipulate[
> For[r = 1, r < 4, r++,
> sol = DSolve[{\[Theta]'[t] == k i[t],
> i'[t] == -k \[Theta][t] - r i[t] + 10,
> i[0] == 0, \[Theta][0] == 0}, {i, \[Theta]}, t];
> ParametricPlot[Evaluate[{i[t], \[Theta][t]} /. sol], {t, 0, n},
> PlotRange -> {{-10, 10}, {-1, 15}}]], {n, 0, 7}]
>
> and i tried tu use two for loop
>
> For [t = 0.1, t < 7, t++,
> For[r = 1, r < 3, r++,
> sol = DSolve[{\[Theta]'[t] == k i[t],
> i'[t] == -k \[Theta][t] - r i[t] + 10,
> i[0] == 0, \[Theta][0] == 0}, {i, \[Theta]}, t];
> ParametricPlot[Evaluate[{i[t], \[Theta][t]} /. sol], {t, 0.1, 7},
> PlotRange -> {{-10, 10}, {-1, 15}}]]]
>
> i am a new user of mathematica so i am sorry for the syntax error!
> can you help me o solve this problem
>

You have a k in your differential equation and therefore you can't plot
it without giving it a numeric value.

Try something like this:

sol = DSolve[{\[Theta]'[t] == k i[t], 
   i'[t] == -k \[Theta][t] - r i[t] + 10, 
   i[0] == 0, \[Theta][0] == 0}, {i[t], \[Theta][t]}, t]

{fi[t_, r_, k_], f\[Theta][t_, r_, k_]} = {i[t], \[Theta][t]} /. 
  sol[[1]]

Manipulate[
 ParametricPlot[{fi[t, r, k], f\[Theta][t, r, k]}, {t, 0, 7},
  PlotRange -> {{-10, 10}, {-1, 11}}],
 {{k, 1}, 0.01, 20, Appearance -> "Labeled"},
 {r, {1, 2, 3}}]  


-- 
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de


  • Prev by Date: Re: manipulate time
  • Next by Date: Re: Displaying Equations Symbolically and Numerically
  • Previous by thread: Re: manipulate time
  • Next by thread: Re: manipulate time