I try to use contour to plot this function
3y + y^3 - x^3 = 5
I try contour(3*y+y^3-x^3-5) but it doesn't work.
How can I use contour to plot this function?
I try to use contour to plot this function
3y + y^3 - x^3 = 5
I try contour(3*y+y^3-x^3-5) but it doesn't work.
How can I use contour to plot this function?
Are x and y properly defined as 2x2 matrices? If so then the "power" operator needs to be done on a component-wise basis (.^3 instead of ^3).
This works:
Maybe you can try
fcontour
, which plots the contour lines of the function z = f(x,y) for constant levels of z over the default interval [-5 5] for x and y.Output:
I'm not convinced this addresses all parts of your question but it's a start. If you absolutely want
contour
to call a function, you can adjust my example tocontour(X,Y,fh(X,Y))
.Better Approach
The Direct Approach (not preferred but works)
Notice the
Z
is transposed to make this work.