how to solve ode which includes ode and integral

1 view (last 30 days)
Emil
Emil on 28 Jul 2014
Answered: Torsten on 6 Jul 2015
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 Comments
RahulTandon
RahulTandon on 6 Jul 2015
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 on 6 Jul 2015
i think the function f(x,y) will have to be futher specified to get a particular solution to the proble!

Sign in to comment.

Answers (2)

RahulTandon
RahulTandon on 6 Jul 2015
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 on 6 Jul 2015
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.

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!