How to solve ODE for independent function

kaushel
Messages
2
Reaction score
0
Hello,

I need to solve numerically an equation of the form

v(t) = k1*z(t)*w(t)-k2*i(t)-k3*di(t)/dt

The issue is that rungekutta methods are useful for solving

di(t)/dt = 1/k3 * [ k1*z(t)*w(t)-k2*i(t)-k3*-v(t) ]

but I need to solve for v(t)

What I did was:

v (t) = k1*z(t)*w(t)-k2*i(t)-k3*[i(t)-i(t-1)]/h

But is not a good approximation because the step size h cannot be small enough. I need a more sophisticated method than directly applying the difference quotient as I did.
Thanks a lot!
 
Physics news on Phys.org
So your problem is just numerically differentiating the known function i(t)? That can be tricky- just reducing the step size in the "difference quotient" can be unstable. You might want to look at the "five-point stencil" given here:
http://en.wikipedia.org/wiki/Numerical_differentiation
 
Thanks HallsofIvy!

I'll give you a little bit more of insight about my problem.
The equations are for an electric generator in stand alone operation, the actual equation is
vd=Lq*iq*wr-Rs*id-Ld*did/dt (I wrote a different one for clarity)
where Lq, Ld, and Rs are constant parameters and vd, iq, wr, and id are functions of time.

My first approach of course was did/dt = (id(t)-id(t-h))/h, then I improved by a higher order approximation of the form did/dt = (3*id(t) - 4*id(t-h) + id(t-2h))/(2*h)
But still I have the same problem that did/dt oscillates too much and get's unstable with h less than 0.002, which is too big for me.
The variables are declare as double in the C code, to have a better precision.

I do my derivative calculation backwards because I can't use future values. I'm using this equation to produce values of vd in a real-time application. So, I obtain say vd(t1) and with that value I calculate id(t2),iq(t2), and w(t2). With the new values I calculate vd(t2). So I can save the history of the system and use it to calculate the derivative, but I don't have future values.

Thanks again for your reply!
 
Thread 'Direction Fields and Isoclines'
I sketched the isoclines for $$ m=-1,0,1,2 $$. Since both $$ \frac{dy}{dx} $$ and $$ D_{y} \frac{dy}{dx} $$ are continuous on the square region R defined by $$ -4\leq x \leq 4, -4 \leq y \leq 4 $$ the existence and uniqueness theorem guarantees that if we pick a point in the interior that lies on an isocline there will be a unique differentiable function (solution) passing through that point. I understand that a solution exists but I unsure how to actually sketch it. For example, consider a...
Back
Top