MathGroup Archive 2012

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

Search the Archive

Re: Re: How to rectify the error for NDSolve ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127195] Re: [mg127172] Re: How to rectify the error for NDSolve ?
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Fri, 6 Jul 2012 03:23:57 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201207051011.GAA01028@smc.vnet.net>

Until you spend the time to learn basics you will continue to make the
same mistakes. You also need to pay attention to details.

You used Subscript[C, 0] and Subscript[c, 0]; pick one.

You cannot use square brackets as if they were parentheses.

Subscript[\[Gamma]\[Omega], 0] should be  \[Gamma] Subscript[\[Omega], 0]


Clear[x, Q, \[CapitalGamma], \[Phi]];
Q = 100;
\[CapitalGamma] = 50;
Subscript[\[Omega], 0] = 10;
Subscript[V, p] = 1/2;
Subscript[c, 0] = 406*10^-6;
\[Phi] = 90;
\[Gamma] = 1/Q;
Subscript[V, 1][t] =
  Sqrt[2] Subscript[V, p] Sin[2 Subscript[\[Omega], 0] t];

eqn = x''[t] + \[Gamma] Subscript[\[Omega], 0] x'[
       t] + (Subscript[\[Omega], 0]^2) (1 +
        Subscript[c, 0] Subscript[V, 1][t]) x[
       t] - \[CapitalGamma] Sin[Subscript[\[Omega], 0] t + \[Phi]] ==
    0 // Simplify;

sol = NDSolve[{eqn, x[0] == 1/2, x'[0] == 0}, x[t], {t, 0, 25}][[1]];

Manipulate[
 ParametricPlot[
  Evaluate[{x[t] /. sol, D[x[t] /. sol, t]}], {t, 0, ub},
  Frame -> True, AxesLabel -> {"t", Overscript[\[Theta], "."]},
  AspectRatio -> 1,
  PlotRange -> {{-40, 40}, {-400, 400}}],
 {ub, Range[5, 25, 5]}]


Bob Hanlon


On Thu, Jul 5, 2012 at 6:11 AM, Rahul Chakraborty <rahul.6sept at gmail.com> wrote:
> Following is the code as modified:
>
>  Clear[x,Q,\[CapitalGamma],\[Phi]];
> Q=100;
> \[CapitalGamma]=50;
> Subscript[\[Omega], 0]=10;
> Subscript[V, p]=1/2;
> Subscript[C, 0]=406 * 10^-6;
> \[Phi]=90;
> \[Gamma]=1/Q;
> Subscript[V, 1][t]=Sqrt[2] Subscript[V, p]Sin[2Subscript[\[Omega], 0]t];
> eqn= x''[t]+Subscript[\[Gamma]\[Omega], 0]x'[t]+(Subscript[\[Omega], 0]^2)[1+Subscript[c, 0]Subscript[V, 1][t]]x[t]-\[CapitalGamma] Sin[Subscript[\[Omega], 0]t+\[Phi]]==0//Simplify;
> sol=NDSolve[{eqn,x[0]==1/2,x'[0]==0},x[t],{t,0,25}][[1]]
> ParametricPlot[Evaluate[{x[t]/.sol,D[x[t]/.sol,t]}],{t,0,25},Frame->True,AxesLabel->{"t",Overscript[\[Theta],"."]},AspectRatio->1]
>
>
>  ERROR showing as follows:
>
>  NDSolve::ndnum: Encountered non-numerical value for a derivative at t == 0.`. >>
>
>  Plz advice me how to correct this error.
>
> Regards,
>
>  rc
>



-- 
Bob Hanlon



  • Prev by Date: Re: Importing RTF
  • Next by Date: Re: Re: Solid modeling using Manipulate
  • Previous by thread: Re: How to rectify the error for NDSolve ?
  • Next by thread: Re: How to rectify the error for NDSolve ?