Need help for loops a function with boundary condition

1 Ansicht (letzte 30 Tage)
Chee Hao Hor
Chee Hao Hor am 15 Mai 2018
I am facing a problem to loop the ODE function, anyone can help me ? I need to have a small increment in time for every ODE function and loop with it. For eg, it start the ODE at time = 0 and end at time = 20, with increment of 0.1. Many thanks !
solinit = bvpinit(linspace(0,1,100),[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');
global t
global t1
t =0:0.1:20;
for t1= 0:increment(t)
function dudy = ex1ode(y,u)
n=1;U = 1; pho = 1; eta = 1;
uini = 0;
dudy = [ u(2)^(1/n) (pho/eta) *((u(1)-0)/ t(t1))];
end
function res = ex1bc (ua,ub)
U=1; omega = 1;
res=[ua(1)- U*sin(omega*t(t1)) ub(1)];
end

Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by