How do I solve a second order ordinary differential equation with boundary conditions?
Show older comments
The equation I am trying to solve is c"+2/a*c'=c/0.4(0.1+c); In my code c is 'x' and t is 'a'. The boundary conditions are dc(0)=0 and c(1)=0 % this function breaks down the second order function into two first order % eq function dxdt=F(t,x) dxdt=[x(2); -2./t.*x(1)+t./(0.04.*(0.01+t))]; end% This function applies the boundary conditions. function res=fb(xa,xb) % xa is the derivative boundary condition and xb the normal boundary % condition res=[xa(2); xb(1)-1]; end % This is the code to solve bme=bvpinit([0.1 1],[0.1 1]); sol=bvp4c(@F, @fb, bme); plot(sol.y(1,:), sol.x); xlabel('a'); ylabel('Ss/S'); title('Plot for S~Km');
Can anyone verify my initial set up is correct and if so, how to just have values from 0 to 1 for my x-axis?
Answers (1)
Sachin Kumar
on 19 Apr 2017
0 votes
Below link has some examples on using bvp4c, you can verify with these examples:
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!