Borrar filtros
Borrar filtros

Problem in plotting the nonlinear differential equation using bvp4c

2 visualizaciones (últimos 30 días)
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,:))

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by