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?

 Respuesta aceptada

madhan ravi
madhan ravi el 7 de Dic. de 2018
Editada: madhan ravi el 7 de Dic. de 2018
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 comentarios

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 el 8 de Dic. de 2018
Editada: madhan ravi el 8 de Dic. de 2018
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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre General Applications en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

el 7 de Dic. de 2018

Comentada:

el 10 de Dic. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by