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 Exchange에서 Partial 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