Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

problem with bvp4c

조회 수: 3 (최근 30일)
FATEMEH
FATEMEH 2011년 12월 14일
마감: MATLAB Answer Bot 2021년 8월 20일
Can anybody help me for the following code? I'm trying to solve a second degree differential equation by bvp4c. I encounter singular jacobian error.
function out= test100(t,y) clc
h=.01; for ii=1:5
if ii==1
q= @(t) -t;
end;
sol=bvpinit(linspace(0,20,20),[1 1]);
sol=bvp4c(@bvpexample,@bc1,sol);
xx=sol.x;yy=sol.y;
ht= @(t) spline(xx,yy(1,:),t);
q= @(t) -numder(ht,t,h);
end
function yprime = bvpexample(t,y) a=10;b=1;c=5;d=5;p=.05;
yprime=[y(2);-1./(2*a.*exp(y(2)-q(t)).*(1+y(2))).*(p*c.*exp(-y(1))+p*d)+y(2).*(p+numder(q,t,h))./(1+y(2))] end
function res=bc1(ya,yb) %BC: Evaluates the residue of the boundary condition res=[ya(1)-10;yb(1)]; end
function der = numder(fun, x, h, varargin) der = (feval(fun,x+h,varargin{:})-feval(fun,x-h,varargin{:}))/(2*h); end
end
  댓글 수: 1
Walter Roberson
Walter Roberson 2011년 12월 14일
http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup

답변 (1개)

Walter Roberson
Walter Roberson 2011년 12월 14일

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by