BVP4C code not giving an output & boundary condition issues.
Infos
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Afficher commentaires plus anciens
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.
Réponses (1)
Stephan
le 18 Mar 2019
0 votes
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 commentaires
Alexander Kimbley
le 18 Mar 2019
Torsten
le 18 Mar 2019
I don't understand what exactly your question is.
Cette question est clôturée.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!