How to solve differential equation
3 views (last 30 days)
Show older comments
Hello,
I have the following equations as seen below, and I need to get out p(x) and t(x). I understand that maybe Runge Kutta method should be used, but I do not se how I can solve it. I write "integrate" to show how the equation looks, not that I believe that matlab works that way.
Constants: Er, Es, pi, xa, xd, t1, R, my, vs.
b(x) = -(2/(pi*Er))*integrate[(p(s)*ln(abs((s+xa)/s-x))]ds; % integrate from -xa to xd
t(x) = t1 - (xa^2-x^2)/R + 2*b(x);
q(x) = my*p(x);
dp/dx = -(Es/t(x))*dt/dx+(vs/(1-vs))*2*q(x)/t(x);
It would be amazing if anyone could help me!
Best regards
Christopher
4 Comments
Torsten
on 7 Jun 2017
So p is to be integrated between -xa and xd and the integral in the expression for b(x) is to be taken between -xa and xd, too ?
Best wishes
Torsten.
Answers (1)
Torsten
on 7 Jun 2017
Choose a grid of stepsize deltax: -xa=x0<x1<x2<...<x_n=xb with x_(i+1)-x_i=deltax.
I suggest you use backward differencing for dp/dx and the trapezoidal rule for the integral.
You'll arrive at n nonlinear equations with unknowns p(x1),...,p(x_n).
The equations can be solved one after the other (sequentially) using MATLAB's "fzero".
Best wishes
Torsten.
See Also
Categories
Find more on Numerical Integration and Differential Equations 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!