Differential equation plotting semicircle instead of circle?
8 views (last 30 days)
Show older comments
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 Comment
Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!