Boundary value problems 371
1function s15h10p1
2clc
3close all
4set(0,‘defaulttextinterpreter’,‘latex’)
15 %plot the two results
16 h = figure;
17 plot(x,c,‘ob’,x,c exact,‘-r’)
18 xlabel(‘$x$’,‘FontSize’,14)
19 ylabel(‘$c(x)$’,‘FontSize’,14)
30 [x,c] = solveBVP(dx,xmin,xmax);
31 c exact = exactSolution(dx,xmin,xmax);
32 err(i) = norm(c-c exact);
33 end
34 h = figure;
45 for i = 1:n
46 c exact(i) = cosh(x(i)) – q*sinh(x(i));
47 end
48
49 function [x,c] = solveBVP(dx,xmin,xmax)