Recently, I tried to build some velocity fields for a training problem in my fluid problems problem. I wrote the following matlab code
clear; h_theta_multiple=0.01; h_theta=h_theta_multiple*2*pi; h_rho=0.1; [theta,rho] = meshgrid(0:h_theta:2*pi,0:h_rho:5); [x1,x2] = pol2cart(theta,rho); N=[1 2 3 -1 -2 -3]; figure for i=1:length(N) n=N(i); u1 = rho.^n .* cos(n.*theta); u2 = rho.^n .* sin(n.*theta); subplot(2,3,i); quiver(x1,x2,u1,u2); end figure for i=1:length(N) n=N(i); u1 = -rho.^n .* sin(n.*theta); u2 = rho.^n .* cos(n.*theta); subplot(2,3,i); quiver(x1,x2,u1,u2); end
It gives me the following 

for the first and second functions, respectively. I cannot understand why this does not mean that for n it is negative ... I tried to isolate everything, but I could not debug it at the end.
source share