where an electric field is minimum for a given discrete charge distribution in a 2D plan. ((PHD issue , help me ))

1 view (last 30 days)
I need to implement a function that computes where an electric field is minimum for a given discrete charge distribution in a 2D plan.
function takes an input Q of different discrete charge distribution in 2D plan, Q is a Nx3 matrix, where each row represents on charge, the first entries of a row is the charge position in the xy plan, and the last entry is charge value. The function will return one position of minimum electric field rounded to the second number after the decimal point. To keep the problem simple, assume our space only spans from (0,0) to (10,10).
by computing scaler values (potential) rather than vectors (electric field). By using gradient built in function you can find electric field every where in space. Helpful function [Ex, Ey] = gradient(V, 0.01, 0.01);
  9 Comments
Scott Webster
Scott Webster on 20 Dec 2014
Well, I think you have correctly identified the idea of the superposition principle, but I think you are confusing your formula a bit with Coulomb's Law for the force between two charges.
Image Analyst has generously given you a big head start on the code, so probably you should start playing around with that and also try to nail down exactly what calculations you need to perform...

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 20 Dec 2014
Edited: Image Analyst on 20 Dec 2014
Here's a snippet to get you started:
function testHarness
clc; % Clear the command window.
numberOfcharges = 5;
% Get x,y,z locations
Q = 10 * rand(numberOfcharges, 3);
minValue = myfunc(Q)
function minValue = myfunc(Q)
% Create field of 1000 by 800 elements or whatever you want.
rows = 1000;
columns = 800;
chargeField = zeros(1000,1000) % What they call "V"
% Get a potential field for every charge and add it in
for k = 1 : length(Q)
for column = 1 : columns
for row = 1 : rows
thisField(row, column) = GetPotential(Q(k,:));
% NOTE: YOU WRITE GetPotential(). Use your formula.
end
end
% Add in the potential for the kth charge to the accumulation field.
chargeField = chargeField + thisField;
end
% Show images.
figure;
fontSize = 20;
subplot(2,2,1);
imshow(chargeField, []);
title('Potential Field', 'FontSize', fontSize);
% Now get the gradient because the problem wanted it.
[Ex, Ey] = gradient(V, 0.01, 0.01);
subplot(2,2,2);
imshow(Ex, []);
title('Ex Field', 'FontSize', fontSize);
subplot(2,2,3);
imshow(Ey, []);
title('Ey Field', 'FontSize', fontSize);
% Find row and column of min potential.
minValue = min(chargeField(:))
% Find row and column where that min occurs
[rowOfMin, columnOfMin] = find(chargeField == minValue);
Try to finish it. There's still plenty for you to do, like plug in the formula for the potential at each pixel's distance from the charges, figure out what z level to use, etc.

More Answers (0)

Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!