Differential equation unable to find a symbolic solution

5 views (last 30 days)
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:
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)

Accepted Answer

Star Strider
Star Strider on 29 Oct 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))
ME(x) = 
[VF,Sbs] = odeToVectorField(ME)
VF = 
Sbs = 
etafcn = matlabFunction(VF, 'Vars',{x,Y})
etafcn = function_handle with value:
@(x,Y)[(1.89e+2./1.09e+2)./(x.*(-4.1e+1./8.0)+Y(1).*1.025e+3+1.5375e+6)]
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 Comments
Rihards
Rihards on 29 Oct 2022
Thanks! Will try to go trough it and see how all of that works.
Am I getting it right that I am unable to define the initial conditions anywhere else other than y(0)?
Star Strider
Star Strider on 29 Oct 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 .
.

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 29 Oct 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

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!