## How to Solve Second Order ODE with 1 boundary condition for y and 1 non-zero boundary condition for y'

### Osman Qamar (view profile)

on 4 Apr 2019
Latest activity Commented on by Osman Qamar

on 5 Apr 2019

### Torsten (view profile)

I'm not sure if MatLab has a built in function to handle this.
To clarify, I'm working with the simple ODE: y''+ay=0 (a is a known constant) and have the following coundary conditions:
1) y(0)=50
2) y'(L)=0 (L is a known constant)
As far as I can tell, ode45 is only applicable for initial value problems and bvp4c requires both boundary conditions to be for y, not y'. I was thiking MatLab would have a built in function to handle this, but I'm not sure at this point.

### Torsten (view profile)

on 4 Apr 2019
Edited by Torsten

### Torsten (view profile)

on 4 Apr 2019

If you convert your second order equation to a system of first-order equations
y1' = y2
y2' = -a*y1
you can use bvp4c to set boundary conditions for y1 (which is y) at x=0 and for y2 (which is y') at x=L.

Osman Qamar

on 5 Apr 2019
Got it, thanks!