![pde_case.asv.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/264632/image.jpeg)
Getting General Solution Using dsolve
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to solve the equation below
ode(x) =
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/237850/image.png)
clc;clear
syms y(x)
RHS = (y + x*(x^2 + y^2)^(1/2))/(x - y*(x^2 + y^2)^(1/2))
ode = diff(y,x) == RHS
ysol = dsolve(ode,'IgnoreAnalyticConstraints', false)
But it is saying that it is unable to find explicit solution. In Wolfram Alpha however, the general solution came out to be
sqrt(x^2 + y(x)^2) + tan^(-1)(x/y(x)) = c_1
How do I get this in Matlab?
0 commentaires
Réponses (1)
Guru Mohanty
le 21 Jan 2020
Hi, I understand that you are not able to find solution through dsolve. The function dsolve can solve differential equations when variables are separable. However you can solve this differential equation using MATLAB Numerical Solver ode45. Here is a sample code.
tspan = -5:0.5:5; % Interval of Integration
y0 = 0; % Initial Condition
[x,y] = ode45(@(x,y)odefun(x,y), tspan,y0);
plot(x,y);
function dydx = odefun(x,y)
dydx = (y + x.*(x.^2 + y.^2).^(1/2))/(x - y.*(x.^2 + y.^2).^(1/2));
end
![pde_case.asv.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/264632/image.jpeg)
0 commentaires
Voir également
Catégories
En savoir plus sur Calculus dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!