How to solve differential equation
Afficher commentaires plus anciens
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 commentaires
Torsten
le 7 Juin 2017
... and the differential equation for p is to be integrated from -xa to xd ?
... and you are sure that the integral in the expression for b(x) is to be taken between -xa and xd, not between -xa and x ?
Best wishes
Torsten.
Christopher Fallqvist
le 7 Juin 2017
Torsten
le 7 Juin 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.
Christopher Fallqvist
le 7 Juin 2017
Réponses (1)
Torsten
le 7 Juin 2017
0 votes
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.
Catégories
En savoir plus sur Numerical Integration and Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!