Need help on loop for an ODE function
Show older comments
This code for an ODE function with boundary condition, and it can only given an answer at selected time,in this coding is at t=1 t. I need to add in a loop with a small time increment, from t=0 to t=20 at increment of t=0.01. Can anyone please help me ? I need to solve this problem.
solinit = bvpinit(linspace(0,1,10),[0,0,]);
sol = bvp4c(@ex1ode,@ex1bc,solinit);
y = linspace(0,1);
u = deval(sol, y);
plot(u(1,:),y)
title ('beta = 1');
xlabel ('u*');
ylabel ('y*');
legend ('t=1');
function dudy = ex1ode(y,u)
t=1;n=1;U = 1; pho = 1; eta = 1;
uini = 0;
dudy = [ u(2)^(1/n)
(pho/eta) *((u(1)-0)/ t)];
end
function res = ex1bc (ua,ub)
t=1;U=1; omega = 1;
res=[ua(1)- U*sin(omega*t)
ub(1)];
end
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!