MATLAB Answers

Ode45 solves an equation that containing a definite integral term

조회 수: 19(최근 30일)
Xuan Ling Zhang
Xuan Ling Zhang 6 Sep 2019
댓글: sitaram sahu 9 Sep 2020
Hi, i have a problem on the following equation when solved by Ode45, which contains a definite integral term. I dont know how to transform it so that it can be solved by ode45.
Eq.gif
can someone help me ?
Thank you in advance

  댓글 수: 2

Star Strider
Star Strider 6 Sep 2019
Is ‘y’ a function of x or t?
Xuan Ling Zhang
Xuan Ling Zhang 7 Sep 2019
Thank you for the concern. It is a superscript (') just looks like (t), due to the display problem.

댓글을 달려면 로그인하십시오.

답변(1개)

Torsten
Torsten 6 Sep 2019
편집: Torsten 6 Sep 2019
function main
a = ...;
b = ...;
c = ...;
d = ...;
u0 = 1;
usol = fzero(@(u)fun(u,a,b,c,d),u0);
fun_ode = @(t,y)[y(2);y(3);y(4);-usol*y(3)-y(1)^2];
y0 = [a;b;c;d];
tspan = [0 1];
[T,Y] = ode45(fun_ode,tspan,y0);
plot(T,Y)
end
function res = fun(u,a,b,c,d)
fun_ode = @(t,y)[y(2);y(3);y(4);-u*y(3)-y(1)^2;y(2)^2];
y0 = [a;b;c;d;0];
tspan = [0 1];
[T,Y] = ode45(fun_ode,tspan,y0);
res = Y(end,5)-u;
end

  댓글 수: 2

Xuan Ling Zhang
Xuan Ling Zhang 7 Sep 2019
Dear Torsten,
Thank you for your valuable answer!!!
sitaram sahu
sitaram sahu 9 Sep 2020
Dear Xuan Ling Zhang, please tell how you solved it,
and Dear Torsten, please explain your answer. it would be very helpfull

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by