MATLAB: I want to plot!!!

plot

[x,y]=meshgrid(-20:0.1:20);
m=2;
U=2;
a=4;
psi = U*y - (m/(2*pi))*(atan(y/(x-a))-atan(y/(x+a)));
contour(x,y,psi);
but I can't get my graphs. They are all blank page.

Best Answer

You need to use element-wise division: https://www.mathworks.com/help/matlab/ref/rdivide.html
[x,y]=meshgrid(-20:0.1:20);
m=2;
U=2;
a=4;
psi = U*y - (m/(2*pi))*(atan(y./(x-a))-atan(y./(x+a)));
%^ dot here and ^ here
contour(x,y,psi);
Related Question