Differential equation unable to find a symbolic solution
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Rihards
el 29 de Oct. de 2022
Respondida: Walter Roberson
el 29 de Oct. de 2022
Hello!
I'm seeking for some assitance in understanding the proper way of tackling this problem:
I am trying to find a solution for the following differential equation:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1173333/image.png)
In my specific case, all of the variables are given, as depicted in the code example below, except eta - which in dependant on x.
I tried the dsolve approach, but while I'm expecting a numerical solution, it's warning be that no symbolic solution can be found instead.
The variable D has a given range, where at x=0, eta is assumed to be equal to 0, which I have listed as a condition for the differential equation, in order to remove the constant part.
I might have something fundumentally wrong with the approach here, but based on the examples, I am having a hard time figuring it out. The end goal here would be to plot out eta(x).
syms eta(x) D_off
X = 300000;
tau_0 = 0;
tau_w = 17.0100;
rho_w = 1025;
g = 9.81;
s = 0.0050;
D_off(x)=X*s-x*s;
ME = -g*diff(eta,x) +(tau_w-tau_0)/(rho_w*(D_off(x)+eta))==0
dsolve(ME,eta(0)==0)
0 comentarios
Respuesta aceptada
Star Strider
el 29 de Oct. de 2022
The equation is nonlinear in η, and dsolve will not solve nonlinear differential equations.
Integrating it numerically gives —
syms eta(x) D_off x Y
X = 300000;
tau_0 = 0;
tau_w = 17.0100;
rho_w = 1025;
g = 9.81;
s = 0.0050;
D_off(x)=X*s-x*s;
ME = -g*diff(eta,x) == -(tau_w-tau_0)/(rho_w*(D_off(x)+eta))
[VF,Sbs] = odeToVectorField(ME)
etafcn = matlabFunction(VF, 'Vars',{x,Y})
xspan = [0 1E6];
[x,eta] = ode15s(etafcn, xspan, 0);
figure
semilogy(x, eta)
grid
xlabel('x')
ylabel('\eta(x)')
% dsolve(ME,eta(0)==0)
Make appropriate changes to get the desired result.
.
8 comentarios
Star Strider
el 29 de Oct. de 2022
As always, my pleasure!
I didn’t see your previous Comment until now. I used the previous end value of ‘eta’ as the initial conditon for the subsequent integration. It is of course acceptable to define the initial condition to be anything you want. It just has to be defined.
There is only one differential equation, and so only one initial condition, that being
.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1173503/image.png)
.
Más respuestas (1)
Walter Roberson
el 29 de Oct. de 2022
dsolve without the initial condition and then try to substitute in the location of the initial condition and try to solve for constants.
You will find that the solution without the initial condition is of the form A*x+b with A and B being specific numeric constants. When you substitute in x=0 you will get the constant b, which is non-zero and so cannot satisfy the required eta(0)==0
0 comentarios
Ver también
Categorías
Más información sobre Calculus en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!