How to plot the Wolfram Alpha grid? [MATLAB]

前端 未结 1 944
甜味超标
甜味超标 2021-01-29 09:10

I would like to plot for any function this grid :

This is the special case for f(z) -> 1/z

This is a typical graph you can find on wolfram alpha. Nevert

1条回答
  •  猫巷女王i
    2021-01-29 09:59

    Try the code below. I have updated the answer to show the lines in different colors.

    clear
    clc
    
    N = 101;
    x = linspace(-1, 1, N);
    y = x;
    [X,Y] = meshgrid(x,y);
    
    Z = X + Y*1i;
    
    f = 1./Z;
    
    U = real(f);
    V = imag(f);
    
    %Plot transformed mesh
    hold off
    plot(U,V,'b-');
    hold on
    plot(U',V','r-');
    
    xlim([-5,5]);
    ylim([-5,5]);
    axis equal
    

    0 讨论(0)
提交回复
热议问题