Matlab code required for 2nd order 2 point BVP

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.

Respuestas (0)

Categorías

Más información sobre Partial Differential Equation Toolbox en Centro de ayuda y File Exchange.

Preguntada:

el 9 de Abr. de 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by