I require a solution for the set od ODE's using MATLAB function 'bvp4c'

The code that I've written is as follows:
function bvp_code_matlab_3
options = bvpset('stats','off', 'RelTol', 1e-6);
solinit = bvpinit(linspace(0,1,4),[0.5,1,0,0,0,0,0]);
sol = bvp4c (@OdeBVP, @OdeBC, solinit, options);
plot (sol.x, sol.y(1,:));
end
% Define ODE
function f = OdeBVP(x,y)
f=[y(2);
y(3);
y(4);
5*(3*y(3)+(1.44-2*y(1))*y(3)-2*(10/5)*y(5)*y(6));
y(6);
5*(2*y(5)+1.44*y(6)+2*y(5)*y(2)-2*y(1)*y(6));
];
end
% Define Boundary conditions
function res = OdeBC (ya,yb)
res = [
ya(5)-1.0;
yb(5)-0.4;
ya(1);
ya(2);
yb(1)-0.5;
yb(2);
]
end
Can someone please tell me where I've gone wrong in the code?

 採用された回答

madhan ravi
madhan ravi 2018 年 12 月 7 日
編集済み: madhan ravi 2018 年 12 月 7 日

0 投票

The reason for the error was you gave 7 intitial conditions whereas only 6 are required
solinit = bvpinit(linspace(0,1,4),[0.5,1,0,0,0,0]); %just change this line
The graph I get
Screen Shot 2018-12-07 at 1.01.14 PM.png

3 件のコメント

Aditya Ramnarayan
Aditya Ramnarayan 2018 年 12 月 8 日
Thank you Sir!
However, if I wanted to write the code for varying values of R and s, how would the code change?
And how do I plot a graph for -g'(0) vs R1 for the above equations?
Thanks.
madhan ravi
madhan ravi 2018 年 12 月 8 日
編集済み: madhan ravi 2018 年 12 月 8 日
Aditya Ramnarayan
Aditya Ramnarayan 2018 年 12 月 10 日
Thank You Sir!
I'm still not able to figure out the code for obtaining the following graph. Could you please help me out by telling me the chnages required to be made in the code in order to get the graph shown in the PNG file that I've attached.
Thanks.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGeneral Applications についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by