Differential equation plotting semicircle instead of circle?
Afficher commentaires plus anciens
Problem: (dy/dx) = (-x/y) , condition: y(sqrt(2)) = sqrt(2)
After solving equation on paper I got equation of a circle x^2 + y^2 = 4, but matlab plots a semicircle of radius 2. Why is this happening?
Code:
eqn='Dy=-x/y';
ini='y(sqrt(2))=sqrt(2)';
y=dsolve(eqn,ini,'x');
disp(y);
x=-2:0.1:2;
y1=eval(vectorize(y));
plot(x,y1)
1 commentaire
Réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!