Tutorial on Solving Boundary Value Problems (BVPs)
Introduction
- Continuation of series on differential equations.
- Focus on boundary value problems (BVPs).
- Comparison with initial value problems (IVPs).
Key Differences Between BVPs and IVPs
- IVPs: Initial conditions provided for y and y' at the beginning of the time interval.
- BVPs: Conditions are given at the boundaries of the interval.
Solving BVPs Using bvp4c Solver
- General Form:
sol = bvp4c(f, bc, solinit)
sol: Solution object
f: System of equations
bc: Boundary conditions
solinit: Initial guess
- Arguments:
- System of equations
f
- States: y and y'
dsdt defined using state variables.
- Example:
y'' = -exp(y) corresponds to dsdt = [y'; -exp(y)]
- Boundary conditions
bc
- Defined such that right-hand side is zero.
- Example boundaries at
a (0) and b (1):
bc = @(ya, yb) [ya(1); yb(1)]
- Initial guess
solinit
- Discretize the interval using
linspace.
- Example initialization with 5 points all set to zero:
solinit = bvpinit(linspace(0, 1, 5), [0 0])
- Running the BVP solver and plotting results.
- Result stored in
sol.x and sol.y.
- Example plotting command:
plot(sol.x, sol.y)
Finding Multiple Solutions
- Use different initial guesses to find different solutions.
- Example: Multiply initial guess values to detect another solution.
Advanced BVP: Including Parameters
- Example with first-order equation and unknown parameter 位.
- System definition:
f = @(t, Y, 位) [Y(2); 0] where Y = [y; 位]
- Boundary conditions:
bc = @(ya, yb, 位) [ya - ...; yb - ...]
- Initial guess:
solinit = bvpinit(linspace(a, b, 50), [initial_y; initial_位])
- Run the solver and extract parameter:
位 = sol.parameters
- Plotting results.
Conclusion
- Summary of BVP solving technique.
- Encouragement to like and subscribe.
Note: Always ensure boundary conditions equate to zero on the right-hand side.