![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/305831/image.png)
ODE symbolic Boundary conditions in respect to another variable
6 次查看(过去 30 天)
显示 更早的评论
Hello,
I have an ODE with three boundary conditions to solve (see code bellow). Having run this code as a .mlx file I see that cond2 is read as:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/305807/image.png)
it takes the derivative in respects to a not r. I wanted to produce such a limit:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/305811/image.png)
I tried changing the condition to:
cond2 = Dw(r==a) == 0
or
cond2 = Dw(r=a) == 0
but it did not do the trick. Could you please tell me how to properly input the boudary condition in respect to r?
Thank you,
Bellow is my code:
clear; clc;
syms a P G t nu F Q r D w(r) h
% Forces
F = - pi * a^2 * P;
Q = (pi*r^2*P) / (2*pi*r);
% ODE
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);
w_0 = subs(wSol,r,0);
0 个评论
采纳的回答
Ameer Hamza
2020-5-30
编辑:Ameer Hamza
2020-5-30
You are correct. The equation is displayed incorrectly. It seems like a bug. However, it seems that this bug only affects the display. The equation is still solved correctly. This bug affects the live script as well as the command window. Therefore, I find it strange that no one noticed it before. The following example shows that inside the symbolic engine, the equation is still represented correctly and gives the correct solution
syms x(t) a
Dx = diff(x);
eq = diff(x, t, 2) == x;
cond = [x(0)==1; Dx(a)==0];
sol = dsolve(eq, cond);
fplot(subs(sol, a, 1), [0 2])
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/305831/image.png)
You may consider filing a bug report.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Equation Solving 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!