Skip to main content
1-Visitor
March 3, 2017
Solved

Is there a way to plot a function of (x,y) like ezplot in Matlab?

  • March 3, 2017
  • 3 replies
  • 8046 views

Hi, guys

I want to plot the function:

f(x,y) = x^2 + y^2 +x*y - 3600, bounded with f(x,y) <=0;

Just like the graph shown below:

untitled.jpg

The figure is plotted with ezplot in Matlab.

function a=elp1(x,y)

     a=x.^2+y.^2-60^2-x.*y;

end

figure(1)

h1=ezplot('elp1',[-90,90,-90,90]);

So far I haven't figured out an alternative in Mathcad that can do this.

Could you help me with some ideas?

Thank you very much!

Best

Shawn

Best answer by ValeryOchkov

One general method for any f(x, y)

f-x-y.png

3 replies

21-Topaz II
March 3, 2017

Hi Shawn Fan,

your function is a quadric which can be plotted as follows:

Shawn 0.jpg

the 2D plot looks like the intersection of the quadric with a plane parallel to the xy plane (z=f(x,y)=a).

Shawn 1.jpg

For me this is the most simple and basic method ...

Shawn 2.jpg

Best Regards

FM

24-Ruby IV
March 3, 2017

One general method for any f(x, y)

f-x-y.png

24-Ruby IV
March 3, 2017

Lace

sfan1-VisitorAuthor
1-Visitor
March 4, 2017

Thank you!

Unfortunately I am using Mathcad Prime now and it appears that Prime cancels the infix operator (so sad)

I would use the convergence of say f(x,y) <= 0 to generate a solid(with many points) circle then.

So sad Prime cancels this useful function that looks like a devolve.

Considering Matlab recommends fplot over the old ezplot, while fplot does not come with the same function as ezplot, I feel a little bit better, LOL...

Still, thank you Valery, thank you FM!

25-Diamond I
March 5, 2017

An ingenious method implemented by Viacheslav  N. Mezentsev to do implicit 2D and 3D plots (even for Prime) can be found here:

Re: implicitplot2d()

sfan1-VisitorAuthor
1-Visitor
March 6, 2017

Thank you so much Werner!

This function is very quick!

I will refer to Mezentsev in my homework.

Thank you!

1-Visitor
March 6, 2017

Another method from Viacheslav A.Tarasov. It works in MC 15 but does not work in the Prime (why?).

ellipse_VAT.png

Viktor