MATLAB: How can I plot this formula in an ellipse shape correctly, the code gives me incorrect ellipse shape (oppiste one). any help please.

contourellipseplot elliptical shape

x = linspace(-1,1); y = linspace(-1,1); [X,Y] = meshgrid(x,y); Z = 3.3 + 0.8*(cos(2*Y)*cosh(2*X))+ 6.5e-10*(cos(4*Y)*cosh(2*X))- 1.5*(cos(2*Y)-cosh(2*X)); contour(X,Y,Z) [C,h]= contour(X,Y,Z); clabel (C,h)

Best Answer

x = linspace(-1,1);
y = linspace(-1,1);
[X,Y] = meshgrid(x(:),y(:));
Z = 3.3 + 0.8.*(cos(2.*Y).*cosh(2.*X))+ 6.5e-10.*(cos(4.*Y).*cosh(2.*X))...
- 1.5.*(cos(2.*Y)-cosh(2.*X));
contour(X,Y,Z)
[C,h]= contour(X,Y,Z);
clabel (C,h)
gives:
.
If this was helpful please accept this answer.
Best regards
Stephan