how to solve ode which includes ode and integral

3 次查看(过去 30 天)
How can I solve the following equations:
df(x,y)/dx= y*f^2(x,y)-dg(x)/dx*f(x,y)/g(x)+y*g(x)
dg(x)/dx=2g(x)*integral{f(x,y)dy} ... (y goes from -t to +t)
with given f(0,y), and g(0).
  2 个评论
RahulTandon
RahulTandon 2015-7-6
THIS IS A ODE ALRIGHT, BUT A SYMBOLIC MATH PROBLEM. IT IS NOT AN ODE45 PROBLEM! OK BY YOU! BELOW IS THE SOLUTION!
RahulTandon
RahulTandon 2015-7-6
i think the function f(x,y) will have to be futher specified to get a particular solution to the proble!

请先登录,再进行评论。

回答(2 个)

RahulTandon
RahulTandon 2015-7-6
clc; syms t x y f(x,y) g(x) k1 k2; Sol = dsolve('Dg - 2*g*int(f,y)','Dx - y*f^2- f/g*Dg','g(0)==k1','IgnoreAnalyticConstraints', true,'y'); % we obtain the symbolic solution to the problem Sol2 = solve(Sol.x==0,Sol.g==0,f(0,y)==k2); Sol.x

Torsten
Torsten 2015-7-6
Choose an equidistant grid in y-direction: yi=-t+(i-1)/(n-1)*2t (i=1,...,n).
Call the ODE Integrator (ODE15s,e.g.) for the n+1 differential equations
df(x,yi)/dx= yi*f^2(x,yi)-2g(x)*integral{f(x,y)dy}*f(x,yi)/g(x)+yi*g(x)
dg(x)/dx=2g(x)*integral{f(x,y)dy}
and approximate the integral via the trapezoidal rule:
integral_{y=-t}^{y=t}{f(x,y)dy}=dy/2*sum_{i=1}^{i=n-1}(f(x,yi)+f(x,y(i+1)))
with dy = 2t/(n-1)
Best wishes
Torsten.

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by