algorithm - How to find the smallest gradient along the contour lines? -
there 6 charges, 2 negative (yellow), , 4 positive (blue) confined plane shown below.
i plotted equal potential lines. now, want draw several lines follow smallest potential gradient (black lines). these lines have properties such not touch positive charges, end @ negative charges.
i did in matlab, , found point on black lines, if calculate potential distribution on line segment perpendicular tangent @ point, smallest potential achieved @ point.
although possible found such points hand when there not many charges, , can connect them make black curves. wondering if there way automate process? when dealing different orientations, how choose 'right area' find smallest potential points? if @ whole domain, smallest potential points located faraway charges.
thank time looking @ problem. please comment below if have thoughts.
cheers, mike
here plots:
here codes.
[x, y] = meshgrid(0:.1:20, 0:.1:20); x = [ 5 15 10 7 9 2]; y = [ 10 10 17 4 13 18]; q = [ 2 1 -2 2 -3 2]; u = zeros(201, 201, 2); uu = zeros(201, 201); = 1:6 r = sqrt((x-x(i)).^2 + (y-y(i)).^2 + 0.01); % avoid nan u(:,:,i) = q(i)./r; uu = uu + u(:,:,i); end [dx, dy] = gradient(-uu); %quiver(x, y, dx, dy,2 ); % define starting point of stremlines (electric field lines) % originating positive charges th = linspace(0,360,19)*pi/180; x0 = 0.1 * cos(th); y0 = 0.1 * sin(th); x1 = 1 * cos(th); y1 = 1 * sin(th); hold on = 1:6 if q(i) > 0 streamline(x, y, dx, dy, x0 + x(i), y0 + y(i)); end end % plot boundaries, starting points picked trial , error streamline(x, y, dx, dy, 13.20, 6.73) streamline(x, y, dx, dy, 13.19, 6.75) streamline(x, y, dx, dy, 1.85, 13.36) streamline(x, y, dx, dy, 1.84, 13.36) streamline(x, y, dx, dy, 5.58, 7.05) streamline(x, y, dx, dy, 5.58, 7.04) hold off
Comments
Post a Comment