(adsbygoogle = window.adsbygoogle || []).push({}); 1. The problem statement, all variables and given/known data

Use one of MatLabs built in functions ode23 or ode45 to draw a curve of the current i(t) when

0.001i''(t) + 200i'(t) + 1/(20*10^-9)i(t)=0

and

i(0)=0

i'(0)=10000

2. Relevant equations

That would be the one above.

3. The attempt at a solution

I know from my work doing this by hand that the solution is

i(t)=(1/20)*e^(-100000t)*sin(200000t)

so I limit my t-span to [0,0.001] - any more and the curve would be invisible.

Doing this in MatLab:

The file current.m has been created, and currently contains the following:

function di=current(t,i)

di=zeros(2,1);

di(1)=i(2);

di(2)=-2*(10^5)*i(2)+(2*10^-7)*i(1);

The command given in the commandline window to create the I(T) values is

[T,I]=ode45(@current,[0,0.001],[0,100000])

followed by plot(T,I)

This gives me an curve that describes an exponential fall from 10^5 to 10^4 over the span of 10^-4 seconds.

This is completely at odds with what I'd expect, looking at the curve I calculated by hand (and completely at odds with an underdampened RLC circuit, which is what the original equation describes - 1mH, 200 ohm and 20 nanofahrad)

EDIT: I should probably point out that I is returned in complex numbers - this is not wholly unexpected, and I suspect that if I knew how to turn the complex I into a sinus rythm, I might get the curve I expected in the first place. I should probably also point out that it's one in the AM where I'm at, so I'm heading to bed. I'll check this thread again tomorrow to look for suggestions or add clarifying information if any is needed.

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Homework Help: How to solve an ode using MatLabs ode23 or ode45

**Physics Forums | Science Articles, Homework Help, Discussion**