Matlab code required for 2nd order 2 point BVP
Show older comments
To keep things simple, consider only 2-point BVPs of the form
u′′ + q( x)u = r ( x)
subject to Dirichlet BCs u(a) = α, u(b) = β.
In order of difficulty:
Write a Matlab function with the following declaration
function u = BvpFD(q,r,a,b,alpha,beta,N)
that solves such a BVP using 2nd order central differences, constants a, b, α, β and
integer N which defines the uniform 1D mesh x1·····xN+1. Although q, r could be
function handles in simple cases, write your code so that q, r are vectors
containing the values
q ( xj ),r ( xj ), j = 1⋯N +1
This means you will have to define the mesh before you call BvpFD.
Answers (0)
Categories
Find more on Partial Differential Equation Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!