# Ode45 solves an equation that containing a definite integral term

4 ビュー (過去 30 日間)
Xuan Ling Zhang 2019 年 9 月 6 日
コメント済み: Xuan Ling Zhang 2019 年 9 月 7 日
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.
can someone help me ?

#### 2 件のコメント

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

サインイン to comment.

### 回答 (1 件)

Torsten 2019 年 9 月 6 日

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

#### 1 件のコメント

Xuan Ling Zhang 2019 年 9 月 7 日
Dear Torsten，