                  Vector Field Examples

 Followings are the code that I wrote in Octave to creates all the plots shown in this page. You may copy these code and play with these codes. Change variables and try yourself until you get your own intuitive understanding.   < Code 1 >   v = -1:0.2:1;  % you can change the range to best fit the plot   a = -1; b = 1;   [x,y] = meshgrid(v);   dx= a * y;  % you can define P(x,y) part according to following examples.   dy= b * x; % you can define Q(x,y) part according to following examples.   hFig = figure(1); quiver(x,y,dx,dy); axis([-1 1 -1 1]); % you can change the range to best fit the plot   set(hFig,'Position',[300 100 600 600]);     < Code 2 >   v = -2*pi:0.2*pi:2*pi;  % you can change the range to best fit the plot   a = 1; b = 1;   [x,y] = meshgrid(v);   dx= a * sin(y);  % you can define P(x,y) part according to following examples. dy= b * sin(x); % you can define Q(x,y) part according to following examples.   hFig = figure(1); quiver(x,y,dx,dy); axis([-2*pi 2*pi -2*pi 2*pi]); % you can change the range to best fit the plot   set(hFig,'Position',[300 100 600 600]);       < Code 3 >   v = -1:0.2:1;  % you can change the range to best fit the plot   a = 1; b = 1;   [x,y] = meshgrid(v);   dx= a .* x ./ sqrt(x .^2 + y .^2);  % you can define P(x,y) part according to following examples. dy= b .* y ./ sqrt(x .^2 + y .^2); % you can define Q(x,y) part according to following examples.   hFig = figure(1); quiver(x,y,dx,dy); axis([-1 1 -1 1]); % you can change the range to best fit the plot   set(hFig,'Position',[300 100 600 600]);       < Code 4 >   v = -2:0.2:2;  % you can change the range to best fit the plot   a = 1; b = 1; x1 = 1; x2 = -1; y1 = 0; y2 = 0;   [x,y] = meshgrid(v);   dx= a .* -(y+y1) ./ ((x+x1) .^2 + (y+y1) .^2) + a .* -(y+y2) ./ ((x+x2) .^2 + (y+y2) .^2);  % you can define P(x,y) part according to following examples. dy= b .* (x+x1) ./ ((x+x1) .^2 + (y+y1) .^2) + b .* (x+x2) ./ ((x+x2) .^2 + (y+y2) .^2); % you can define Q(x,y) part according to following examples.   hFig = figure(1); quiver(x,y,dx,dy); axis([-2 2 -2 2]); % you can change the range to best fit the plot   set(hFig,'Position',[300 100 600 600]);     < Code 5 >   v = -2:0.2:2;  % you can change the range to best fit the plot   a = 1; b = 1; x1 = 1; x2 = -1; y1 = 0; y2 = 0;   [x,y] = meshgrid(v);   dx= a .* (y+y1) ./ ((x+x1) .^2 + (y+y1) .^2) + a .* -(y+y2) ./ ((x+x2) .^2 + (y+y2) .^2);   dy= b .* -(x+x1) ./ ((x+x1) .^2 + (y+y1) .^2) + b .* (x+x2) ./ ((x+x2) .^2 + (y+y2) .^2);   hFig = figure(1); quiver(x,y,dx,dy); axis([-2 2 -2 2]); % you can change the range to best fit the plot   set(hFig,'Position',[300 100 600 600]);     < Code 6 >   v = -2:0.2:2;  % you can change the range to best fit the plot   a = -1; b = 1; c = -1; d = 1; x1 = 1; x2 = -1; y1 = 0; y2 = 0;   [x,y] = meshgrid(v);   dx= a .* (x+x1) ./ ((x+x1) .^2 + (y+y1) .^2) + b .* (x+x2) ./ ((x+x2) .^2 + (y+y2) .^2);   dy= c .* (y+y1) ./ ((x+x1) .^2 + (y+y1) .^2) + d .* (y+y2) ./ ((x+x2) .^2 + (y+y2) .^2);   hFig = figure(1); quiver(x,y,dx,dy); axis([-2 2 -2 2]); % you can change the range to best fit the plot   set(hFig,'Position',[300 100 600 600]);