필터 지우기
필터 지우기

Problem in plotting the nonlinear differential equation using bvp4c

조회 수: 2 (최근 30일)
Muhammad Fahad
Muhammad Fahad 2016년 4월 7일
댓글: Walter Roberson 2016년 4월 7일
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
Walter Roberson
Walter Roberson 2016년 4월 7일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Boundary Value Problems에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by