I have been working on a project where I need to find a solution to the given nonlinear differential equation, see figure below:
Now, I have tried using matlabs built-in function bvp4c, but the syntax is difficult and I don't know if the results are reliable. For some values the bvp4c function only generates an error. I also have boundary conditions to take into consideration, see figures below:
I am sorry for the terrible sizes of the figures. Now I know this is not a mathforum, but I need to numerically solve this and I want to solve it with the best method available. My code as of now is seen below:
function [theta_0 y2]=flow_BVP
theta_0=linspace(0,1,1000); % pi/18
solinit2=bvpinit(theta_0,[0 1 1]);
sol2=bvp4c(@flow_ode,@flow_bc,solinit2);
x2=sol2.x;
y2=sol2.y(1,:);
hold on
%plot(x1,y1) %gammal
plot(x2,y2) %ny
%hold off
function v=flow_init(x)
v=[sin(x); 1; 1];
function dydx=flow_ode(x,y)
q=0.0005;
v=1;
dydx = [y(2); y(3); 2*q/v*y(1)*y(2)-4*y(2)];
function res=flow_bc(ya,yb)
res=[ya(1);yb(1);ya(2)-5.59];
To repeat my question, which is the best method, easiest, simplest to understand and implement to solve this? Shooting perhaps?
Best regards SimpleP.
Edit The result I have gotten so far is this
The plot shows f vs. \theta . The integral is 1, as it should be.