Message Boards Message Boards

NDSolve doesn't produce a smooth curve

Posted 7 months ago

I was solving a parallel RLC circuit with NDSolve, for some reason, it doesn't give a smooth curve. Any suggestions? Thank you!

eqn = c v''[t] + v'[t]/r + v[t]/l == 
    128000 Cos[6400 t + Pi/2] /. {r -> 50, l -> 10, c -> 1/640};
cond = {v[0] == 5, v'[0] == 11456};
sol4 = NDSolveValue[{eqn, cond}, v, {t, 0, 0.6}]
Plot[sol4[t], {t, 0, 0.6}, PlotRange -> All] 

enter image description here

enter image description here

POSTED BY: Xiangyang Zhou
Posted 7 months ago

Do

DSolveValue[{eqn, cond}, v, {t, 0, 6/10}]

to see what is happening. That returns

Function[{t}, (5*(409272678401*Cos[(24*t)/5] + 
    4*(81920000*E^((32*t)/5)*Cos[6400*t] -
    5597847671347*Sin[(24*t)/5] + 
    40959936000*E^((32*t)/5)*Sin[6400*t])))/
    (409600358401*E^((32*t)/5))]

Notice that includes Cos[24/5 t],Sin[24/5 t] but it also includes Cos[6400 t], Sin[6400 t] and I am guessing those last two items are a high frequency oscillation imposed on top of your much lower frequency behavior.

If I use

Plot[sol4[t], {t, 0, 0.06}, PlotRange -> All]

the the high frequency oscillation is much more obvious. Or if I include PlotPoints->100 or PlotPoints->400 then the higher frequency is more uniformly included.

I am guessing this problem is because of your very large coefficients in your equation and that you have perhaps not used sufficient steps or sufficient working precision, but that is just a guess. Or possibly there really are two very different frequencies within the differential equations that you have constructed.

Study this carefully. Track down exactly the source of the problem. That should be educational.

POSTED BY: Bill Nelson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract