BVP4C code not giving an output & boundary condition issues.
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
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.
Antworten (1)
Stephan
am 18 Mär. 2019
0 Stimmen
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 Kommentare
Alexander Kimbley
am 18 Mär. 2019
Torsten
am 18 Mär. 2019
I don't understand what exactly your question is.
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!