LabVIEW

cancel
Showing results for
Did you mean:

How can I get the Runge-Kutta Integrator to accept more than 2 functions? (it'll take 6 variable names and initial conditions, but not F(x,t...))

I tried to save the stock .vi with the modified array sizes.. but even with a 6x1 array it still wouldn't accept the input.
Message 1 of 5
(2,769 Views)

Re: How can I get the Runge-Kutta Integrator to accept more than 2 functions? (it'll take 6 variable names and initial conditions, but not F(x,t...))

guy,

I'm not sure which VI you are referring to. The only Runge-Kutta vi I found was "ODE Runge Kutta 4th Order.VI" for differential equations. Is this a toolkit VI?
Message 2 of 5
(2,769 Views)

Re: How can I get the Runge-Kutta Integrator to accept more than 2 functions? (it'll take 6 variable names and initial conditions, but not F(x,t...))

Aaron,

The ODE RK4.vi you listed is the one I'm referring to. The there are 6 inputs to this .vi:
1) start time
2) stop time
3) step
4) names of variables
5) functions (right hand sides of ODE)
6) Initial conditions

the last 3 inputs are arrays, and the .vi will accept a 1x6 for the variable names and the initial conditions, but only a 1x2 array for the functions. Then it gives me an error to the effect that the input arrays aren't the same. I'm using a 1x6 string array for the input.
Message 3 of 5
(2,769 Views)

Re: How can I get the Runge-Kutta Integrator to accept more than 2 functions? (it'll take 6 variable names and initial conditions, but not F(x,t...))

If I remember the way the Runge Kutta method works correctly; with 6 variables, don't you need 6 functions and 6 innitial conditions? Make sure you aren't leaving active elements in your input array. Even if there is nothing in one of the string elements of the arrays, it can still be active and included in the size of the array. Its probably one of the first things it checks when looking for syntax.
Message 4 of 5
(2,769 Views)

Re: How can I get the Runge-Kutta Integrator to accept more than 2 functions? (it'll take 6 variable names and initial conditions, but not F(x,t...))

Aaron,

In this specific case, I'm solving 6 first order ODEs. dx1/dt through dx6/dt, with initial conditions. Specifically, the equations look something like:

dx1/dt = x4
dx2/dt = x5
dx3/dt = x6
dx4/dt = -constant*(x1)/r - constant*(x4)/constant
dx5/dt = -constant*(x2)/r - constant*(x5)/constant
dx6/dt = -constant*(x3)/r - constant*(x6)/constant

the problem is, that the input array for F(x,t) will only accept the first two equations. As I stated, it will take all 6 initial conditions and all 6 variable names (x1 through x6).

It's ok tho... I'm just gonna code it in C++. It's easier to write my own RK4 🙂

Thanks for your time and replies tho.

Guy
Message 5 of 5
(2,769 Views)