MATLAB: Plot (X^2/cosh^​2(v))+(y^2​/sinh^2(v)​)=1

matlab functionplotting

Hi,
How I can plot this function as v= constant such as for
v=0,pi/2,and pi
(X^2/cosh^2(v))+(y^2/sinh^2(v))=1
Thanks

Best Answer

  • One option (if I understood your Question correctly):

    v = pi/2;
    f = @(X,Y) (X.^2./cosh(v).^2)+(Y.^2./sinh(v).^2)-1;
    x = linspace(-5, 5, 50);
    [X,Y] = meshgrid(x);
    
    figure(1)
    surf(X, Y, f(X,Y))
    grid on
    xlabel('X')
    ylabel('Y')
    title('v = ^{\pi}/_2')