solve a system of ode by bvp4c
Show older comments
Hi, I am trying so solve a system of boundary value problem. I have tried looking into the examples given yet I still have problem in writing the code and running the program.
Briefly, I have 3 equations to solve. I have convert them to first order system in order to put it in matlab. Where, I let W=y1, W'=y2, U=y3, U'=y4, U''=y5, V=y6, V'=y7, V''=y8. I have the boundary 0f x from [0 infinity], and I choose infinity=20. I also need to plot graphs of x-axis:x (from 0 to 20) for y-axis:U, V and W respectively.
I know there are lots of mistakes here hence please correct me if Im wrong. I have attached the code here.
Thank you :))
3 Comments
Torsten
on 13 Jan 2016
Please include equations and boundary conditions in a mathematical notation.
Best wishes
Torsten.
Day Rosli
on 13 Jan 2016
Taylor Nichols
on 24 Jan 2019
how did you arange the boundary conditions in your code if you don't mind me asking?
I've only done a ODE with one dependent variable in which I arranged my conditions this way
This is a 4th order equation btw.
bc = [yl(1) - hi;
yl(2);
yr(1) - ho;
yr(2)];
Accepted Answer
More Answers (1)
Torsten
on 18 Jan 2016
I mean that the function F1 from above is given by
F1(W,U,U',V,V') = (c1*a2-c2*a1)/(b1*a2-b2*a1)
and the function F2 from above by
F2(W,U,U',V,V') = -(c1*b2-c2*b1)/(b1*a2-b2*a1)
Now you can define your array "dydx" in function "ex11ode" by
dydx = [-2Y(2)+x(1-n/n+1)Y(3)
Y(3)
F1(Y(1),Y(2),Y(3),Y(4),Y(5))
Y(5)
F2(Y(1),Y(2),Y(3),Y(4),Y(5))]
Best wishes
Torsten.
9 Comments
Day Rosli
on 18 Jan 2016
Torsten
on 18 Jan 2016
Answered under
Best wishes
Torsten.
Torsten
on 21 Jan 2016
Why don't you just solve the ODEs with right limit x=20 instead of x=10 ?
Does the solver encounter difficulties finding a solution ?
Best wishes
Torsten.
Day Rosli
on 21 Jan 2016
Torsten
on 22 Jan 2016
Since you set n=1, c is identically 1.
Best wishes
Torsten.
Day Rosli
on 22 Jan 2016
Torsten
on 25 Jan 2016
Something like
c=(sol.y(4,:).^2+sol.y(5,:).^2).^((1-n)/(n+1));
plot(sol.x,c);
after the call to bvp4c should work.
Best wishes
Torsten.
Day Rosli
on 25 Jan 2016
Categories
Find more on Numeric Solvers 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!