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.

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangePartial Differential Equation Toolbox についてさらに検索

質問済み:

2021 年 4 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by