LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Non-linear ODE

Hello everybody,

Does anybody know if non-linear second order ODE can be solved with the Runge-Kutta solver. This appears to be the most common solver.

I am trying to solve a non-linear second order differential equation of the form x*x’’ +x’^2 =Const. I was looking for an example that I could use to start with and follow it. I found one called “SHOOTING METHOD”.

for f(x(t),y(t),y) I used (1/x)*(-y*y+Const)  

Originally, I used x(0) =0.01 and x(1) = 0.01 for my boundary conditions but the solution just increases linearly with time as opposed to reaching a maximum and decreasing back to zero in time.

Any help is greatly appreciated. Thanks in advance.

Roberto

0 Kudos
Message 1 of 7
(3,597 Views)

Hi, Roberto

 

your problem is defined as x*x''+x'^2=const.

 

which could be written as ODE: y_1=x, y_2=x'

 

                            y_1'=y_2

                            y_2'=(1/y_1)*(const-y_2^2)

This form with initial value could be solved by ODE solver. 

But your problem is boundary value prolem(BVP), So you mentioned "shooting method", which reformulate the boundary value to intial value so that the ODE solver could be used.

 

The key to your problem is how to reformulate BVP to IVP, not to choose what kind of ODE solvers.

 

This is a non-linear BVP problem, and the simple "shooting method" (usually used in linear BVP)may not work. Mutiple shooting method could help.

 

Bruce

0 Kudos
Message 2 of 7
(3,552 Views)

Could this be a solution to your problem?

 

Constrained Nonlinear Optimization.vi

From the help: Solves a general nonlinear optimization problem with nonlinear equality constraint and nonlinear inequality constraint bounds using a sequential quadratic programming method.

0 Kudos
Message 3 of 7
(3,547 Views)

A shooting method reformulates the BVP as an optimization of the initial conditions of IVP.  In your 2nd order ODE that means that the initial conditions are y(0) and y'(0), and the specified boundary conditions are y(0) and y(1).  The first initial condition is just the first boundary condition, but y'(0) must be determined to produce y(1).  I wrote a VI that sweeps over a series of y'(0) values, solves the ODE for each set of initial conditions, and graphs y(1)-desired_boundary.  If y(1)-desired_boundary=0 then the initial conditions exactly produces the desired boundary conditions.  Please see 'sweep rhs1.vi' in the attached archive.  Run using the defaults.  Once the zero is bracketed then an automatic root finder may be employed to solve for the initial condition with more precision.  The zero-finder must have a bracketed interval (change in sign of the function around the desired level).  See optimize rhs1.vi for an example using a Newton-Raphson zero finder to solve for the y'(0)initial condition.

 

Please note that the Newton-Raphson is a 1-D implementation only.

 

-Jim

Message 4 of 7
(3,531 Views)

Hi, Roberto!

 

Since the equation is given as x*x''+x'^2=const,

The problem would be written as ODE mentioned by Bruce: y_1=x, y_2=x'

 

 y_1'=y_2

y_2'=(1/y_1)*(const-y_2^2).

 

 

 

It is difficult to solve the ODE without the information about the y'(0).

 As mentioned above, the key to the problem is how to reformulate to the IVP.

 Is there any information about the y'(0)??

 

Good Luck!

 

 

 Hiroaki AE-NIJ

0 Kudos
Message 5 of 7
(3,506 Views)

Hi Jim,

 

I think you are totally right. In my equation I know y(0) but I do not know the value of y’(0). So just like you say y’(0) must be determined to produce y(1). I had not thought of applying a routine that sweeps through a set of y’(0) values and obtain the desired y(1) value. I will be working on this a little more before I get the solution to my equation.

 

I was not able to open your file because I am using LabView 8.5 and your vi appears to be made in LabViewe 8.6, however I really appreciate your feedback.

 

Thank you everybody for replying to my question, it is great to have this type of support.

 

Best regards,

Roberto

0 Kudos
Message 6 of 7
(3,485 Views)

Roberto,

 

Here is the project saved in LabVIEW 8.5.  The sweep of y'(0) is contained in 'sweep rhs1.vi' and is just a manual version of what the shooting method does automatically.  Notice that the zero value on the graph occurs for 6<y'(0)<7. The fully automatic shooting method is implemented in 'optimize rhs1.vi' and determines y'(0) to be 6.79.  I assumed const=2, and the boundary conditions y(0)=0.01, y(1)=1.415.

 

-Jim

0 Kudos
Message 7 of 7
(3,469 Views)