Trying to find out absolute potential due to a point charge
2 views (last 30 days)
Show older comments
I have an vector that hold the position of an observer as well as an excel file that hold values for Q charge and x y z coordinates of a point charge. I have to use this equation V=Q/4*pi*epsilon[norm(observer-pointchargelocation)] for all of the elements in the excel file. I know how to do this one at a time but I was hoping someone could point me in the direction of a quicker way to isolate the xyz position of each row and find the magnitude. My test code so far to find one potential is this
observer_Test=[1 -3 4];
pointCharge=[3 -5 3];
epsilon=8.85e-12;
distance=observer_Test-pointCharge;
q=3;
magnitude=norm(distance);
v=q/(4*pi*epsilon*magnitude)
however I would like to extract the magnitude for each point charge position rather than do them one by one. Also I know to extract each charge from the charge column of the excel I would do something like
for i=numel(Q)
charge=Q(i)
end
However I dont know how to extract the rows of each position x,y,z and norm them and then apply the above equation to each charge to get the potential then sum all the potentials up.
0 Comments
Answers (0)
See Also
Categories
Find more on Spreadsheets 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!