How to solve ODE for independent function

Click For Summary
SUMMARY

The discussion focuses on solving the ordinary differential equation (ODE) for the independent function v(t) in the context of an electric generator's operation. The user initially attempted to use a basic difference quotient for numerical differentiation but encountered instability with small step sizes. They explored higher-order approximations, specifically the five-point stencil method, to improve accuracy. The challenge remains in achieving stable results for the derivative did/dt while ensuring real-time calculations in a C programming environment.

PREREQUISITES
  • Understanding of ordinary differential equations (ODEs)
  • Familiarity with numerical differentiation techniques
  • Knowledge of C programming for real-time applications
  • Basic concepts of electric generator operation and parameters
NEXT STEPS
  • Research the five-point stencil method for numerical differentiation
  • Explore advanced Runge-Kutta methods for solving ODEs
  • Investigate adaptive step size techniques in numerical analysis
  • Learn about stability analysis in numerical methods for ODEs
USEFUL FOR

Electrical engineers, software developers working on real-time systems, and researchers in numerical methods for solving differential equations.

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!
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 0 ·
Replies
0
Views
4K
  • · Replies 36 ·
2
Replies
36
Views
6K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 15 ·
Replies
15
Views
3K