Need help on loop for an ODE function
古いコメントを表示
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
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!