tags:

views:

266

answers:

2

I wish to plot implicit functions in MATLAB. Like x^3 + xy + y^2 = 36 , equations which cannot be made into simple parametric form. Is there any simple method ?

I guess it is a very noob-ish question, sorry ..... have never gone exotic in MATLAB !

A: 

Implot2 and implot from Matlab Central appear to do the job.

Justin Peel
@Justin : Thanks, will have a look
Arkapravo
+4  A: 

Here are a couple of options...

Using EZPLOT:

The easiest solution is to use the function EZPLOT:

ezplot('x.^3 + x.*y + y.^2 - 36',[-10 10 -10 10]);

Which gives you the following plot:

alt text


Using CONTOUR:

Another option is to generate a set of points where you will evaluate the function f(x,y) = x^3 + x*y + y^2 and then use the function CONTOUR to plot contour lines where f(x,y) is equal to 36:

[x,y] = meshgrid(-10:0.1:10);   %# Create a mesh of x and y points
f = x.^3+x.*y+y.^2;             %# Evaluate f at those points
contour(x,y,f,[36 36],'b');     %# Generate the contour plot
xlabel('x');                    %# Add an x label
ylabel('y');                    %# Add a y label
title('x^3 + x y + y^2 = 36');  %# Add a title

The above will give you a plot nearly identical to the one generated by EZPLOT:

alt text

gnovice
@gnovice : It is working ! .... working good ..... but I am not very comfortable with the formulation .... anyways, whatever plots my curves :)
Arkapravo
@gnovice: are there any other methods than ezplot ..... ezplot works great ....just asking for some alternatives (Matlab usually has alternatives)
Arkapravo
@Arkapravo: I added another option in addition to EZPLOT.
gnovice
@gnovice: pretty as ever!
Jonas

related questions