I am attempting to solve this boundary value problem however I am struggling with actually obtaining the correct results. Here is the code I have:
function [sol] = bvs(Pr)%Inputs:
%Pr - the Prandtl number
%If Pr not given
if nargin < 1 Pr = .7; end%Set upper boundary
yinf = 10;%Create node vector and initial guesses
x = linspace(0,yinf,100);init = bvpinit(x,[0,0,1,1,0]);%Run ODE solver
options = bvpset('RelTol',1e-8,'AbsTol',1e-12);sol = bvp4c(@odefun,@bcfun,init,options);%Nested funtion to define the ODE
function dydx = odefun(x,y) dydx = zeros(5,1); dydx(1) = y(2); dydx(2) = y(3); dydx(3) = (-y(1).*y(3))./2; dydx(4) = y(5); dydx(5) = ((Pr.*y(2).*y(4)) - (Pr.*y(1).*y(5)))./2; end%Nested function to define the boundary conditions
function res = bcfun(yl,yr) res = zeros(5,1); res(1) = yl(1); res(2) = yl(2); res(3) = yr(3)-1; res(4) = yl(4)-1; res(5) = yr(5); endend
Can anyone help point out errors I have in my code?
Best Answer