BVP4C code not giving an output & boundary condition issues.
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
Hi, I'm really new to matlab so the attached code could be completley wrong but I've attached it anyway. It doesn't give an output and I have no idea how to fix it, for refrence to the problem im just recreating the unbounded shear layer problem in Introduction to hydrodyanmics, Drazin and Reid. I'm using the boundary conditons y(-1)=1 and y(1)=A=2, say. Although I can give other boundary conditions which also must be satisfied anyway, we have y'(-1)=(-1+(1+c)a)/(1+c) and y'(1)=(A-(1-c)a)/(1-c).
Any help would be brilliant and if you could alter the problem to satisfy/add the other conditions it would be amazing.
Thanks.
댓글 수: 0
답변 (1개)
Stephan
2019년 3월 18일
0 개 추천
Hi,
your function does not return anything. Try:
sol = main;
subplot(2,1,1)
plot(sol.x,sol.y)
grid
subplot(2,1,2)
plot(sol.x,sol.yp)
grid
function sol = main
xlow=-1; xhigh=1;
solinit=bvpinit(linspace(xlow,xhigh,2000),[0,0]);
sol=bvp4c(@bvp4ode, @bvp4bc, solinit);
end
function dydx=bvp4ode(~,y)
a=0.4;
dydx=[y(2) (a^2)*y(1)];
end
function res=bvp4bc(ya,~)
A=2;
res=[ya(1)-1 ya(2)-A];
end
Best regards
Stephan
댓글 수: 2
Alexander Kimbley
2019년 3월 18일
Torsten
2019년 3월 18일
I don't understand what exactly your question is.
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!