How to solve ODE with symbolic conditions

Hello,
I have an issue with the boundary conditions for this ODE. With the code as is it assumes that Dw is a function of a not that for r it should subsitute a. How can I solve this?
clear; clc;
syms a P G t nu F Q r D w(r)
F = - pi * a^2 * P
Q = (pi*r^2*P) / (2*pi*r)
ode = diff(((1/r)*diff((r*diff(w,r)),r)),r) == Q/D
Dw = diff(w,r);
cond1 = Dw(0) == 0
cond2 = Dw(a) == 0
cond3 = w(a) == 0
conds = [cond1 cond2 cond3];
wSol(r) = dsolve(ode,conds)
In all I try to solve this ODE:
with the following 3 BC:
Thank you,

 Accepted Answer

Hi,
I tried to solve the differential equation with the given code and I see that the returned wSol(r) is a function of r only and not a. Also, DW too is a function of r if you check in the workspace about the independent variable present for DW. I checked the solution too and it looks correct to me.
This is the solution I got.
wSol(r) = (P*a^4 - 2*P*a^2*r^2 + P*r^4)/(64*D);
You may want to check again about the correctness of the solution.

7 Comments

Yes they are all functions of r. What I meant by w(a) == 0 is w(r=a) = 0; w is equal zero when the r is given as a; same logic for Dw(a).
The results seems correct but I still cannot obtain it. If I run the code pasted in the question I have such an error & output:
Warning: Unable to find explicit solution.
> In dsolve (line 190)
wSol(r) =
[ empty sym ]
Did you change anything in the code to obtain?
wSol(r) = (P*a^4 - 2*P*a^2*r^2 + P*r^4)/(64*D);
Hi Aleksander,
I ran the same code and it produced the output as I mentioned. Can you tell which MATLAB release you working with so that I can reproduce the issue on my side.
Hello,
Using: R2019b Update4 (9.7.0.1296695)
Thank you,
From my experience with the symbolic toolbox, I have noticed that Mathworks has made significant improvements in the Symbolic toolbox in R2020a. Now it is able to solve equations not solvable in previous releases. This might be one of the reason.
Ok I will see if I can update to R2020
Thank you
Hi,
I tried running the script in MATLAB R2019b and didn't get the solution. So, I brought this issue to the notice of our developers, they may investigate further. As I also ran the script in R2020a and R2019a and I was getting the solution, the current workaround will be to try running the script in any of the two release I mentioned.
Updated to R2020a. Now it works fabulously.
Thank you.

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2019b

Community Treasure Hunt

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

Start Hunting!