Error in bvp4c
이전 댓글 표시
I have to solve the following equation using bvp4c. But I cannot understand the error in my code.
where p=1 and boundary conditions are 
Please help me to find the error in the code.
p=1;
xmesh = linspace(-1,1,5);
solinit = bvpinit(xmesh,@guess);
sol = bvp4c(@bvpfcn,@bcfcn,solinit);
plot(sol.x,sol.y,'-o');
function dydx = bvpfcn(p,x,y)
dydx = zeros(2,1);
dydx = [y(2)
(-2+8*x^2*y(1))/(p+x^2)^2];
end
function res = bcfcn(p,ya,yb)
res = [ya(1)-(1/(1+p))
yb(1)-(1/(1+p))];
end
function g = guess(x)
g = [sin(x)
cos(x)];
end
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Boundary Value Problems에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




