Problem in plotting the nonlinear differential equation using bvp4c
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I selected three different nonlinear ordinary differential equations and solve then by using builtin command bvp4c;but all times MATLAB gives me the plot similar to "upward parabola".I want to ask why this happend?why the behavior of graph is almost same for three totally different problems? thank you
Problem 1:
function yp=myodefun(t,y)
yp=zeros(2,1);
yp(1)=y(2);
yp(2)=(1/8)*(32+2*t^3-y(1)*y(2));
function res=mybcfun(ya,yb)
res=zeros(2,1);
res(1)=ya(1);
res(2)=yb(1);
clear all
clc
solinit = bvpinit([1 3],[17 43/3]);
sol = bvp4c(@myodefun,@mybcfun,solinit);
xint = linspace(1,3);
yint = deval(sol,xint);
plot(xint,yint(1,:))
Problem 2:
function yp=odefun(t,y)
yp=zeros(2,1);
yp(1)=y(2);
yp(2)=2*(y(1))^3;
function res=bcfun(ya,yb)
res=zeros(2,1);
res(1)=ya(1);
res(2)=yb(1);
clear all
clc
solinit = bvpinit([-1 0],[0.5 1/3]);
sol = bvp4c(@odefun,@bcfun,solinit);
xint = linspace(-1,0);
yint = deval(sol,xint);
plot(xint,yint(1,:))
Problem 3:
function yp=odefun(t,y)
yp=zeros(2,1);
yp(1)=y(2);
yp(2)=-(y(2))^2-y(1)+log(t);
function res=bcfun(ya,yb)
res=zeros(2,1);
res(1)=ya(1);
res(2)=yb(1);
clear all
clc
solinit = bvpinit([1 2],[0 log(2)]);
sol = bvp4c(@odefun,@bcfun,solinit);
xint = linspace(1,2);
yint = deval(sol,xint);
plot(xint,yint(1,:))
1 comentario
Walter Roberson
el 7 de Abr. de 2016
I do not know, but possibly you might find something useful in the discussion in the comments in http://www.mathworks.com/matlabcentral/answers/275162-troubleshooting-my-code-15-lines#answer_214803 where someone else was having a similar difficulty.
Respuestas (0)
Ver también
Categorías
Más información sobre Boundary Value Problems en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!