plot - Plotting Implicit Algebraic equations in MATLAB -
i wish plot implicit functions in matlab. x^3 + xy + y^2 = 36 , equations cannot made simple parametric form. there simple method ?
here couple of options...
using ezplot
(or fplot
recommended in newer versions):
the easiest solution use function ezplot
:
ezplot('x.^3 + x.*y + y.^2 - 36', [-10 10 -10 10]);
which gives following plot:
using contour
:
another option generate set of points evaluate function f(x,y) = x^3 + x*y + y^2
, use function contour
plot contour lines f(x,y)
equal 36:
[x, y] = meshgrid(-10:0.1:10); % create mesh of x , y points f = x.^3+x.*y+y.^2; % evaluate f @ points contour(x, y, f, [36 36], 'b'); % generate contour plot xlabel('x'); % add x label ylabel('y'); % add y label title('x^3 + x y + y^2 = 36'); % add title
the above give plot identical 1 generated ezplot
:
Comments
Post a Comment