How to plot the Wolfram Alpha grid? [MATLAB]

元气小坏坏 提交于 2019-12-02 22:52:02

问题


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. Nevertheless I don't know how to proceed. The idea would be to see where the lines of the complex grid of the 1-square is sent after applying f.

One thing that could be great would be to add colors on the grid in order to see where the left part is sent. (like here : https://www.youtube.com/watch?v=JX3VmDgiFnY) If you have any idea... thank you.


回答1:


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


来源:https://stackoverflow.com/questions/53472184/how-to-plot-the-wolfram-alpha-grid-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!