Ask your own question, for FREE!
Engineering 8 Online
OpenStudy (anonymous):

Does anyone know how to create a code on Matlab to find the Electric Field at one point from many charges?

OpenStudy (anonymous):

Nvm. Thats force. not EMF.

OpenStudy (anonymous):

Never-the-less, are you modeling the charges as point charges?

OpenStudy (anonymous):

yes

OpenStudy (anonymous):

\[ E = {1 \over 4 \pi \epsilon_0} \sum_{i=1}^N {Q_i \over r_i} \bf \hat r\] We need to implement this summation. How do you want to place the charges? By their coordinates or by their distance and direction from the point where we which to measure the electric field?

OpenStudy (anonymous):

I have two charges one placed on (2,0) and the other placed on (-2,0) and the point I want the E on is (0,5)

OpenStudy (anonymous):

Okay. Let's make two matricies. I = [0,5] L = [2,0;-2,0] Then implement a loop to find the unit vector between each row in L to vector I. for i=1:size(L,1) distance(i) = sqrt((I(1) - L(i,1))^2 + (I(2) - L(i,2))^2) U(i,1) = L(i,1)/distance; U(i,2) = L(i,2)/distance; end U will be the unit vector or \(\bf \hat r\) in the above equation. Then then just perform the summation. The variable 'distance' is r in the equation above.

OpenStudy (anonymous):

The loop needs to be modified to add this after the distance line. V(i,1) = I(1) - L(i,1); V(i,2) = I(2) - L(i,2); then U(i,1) = V(i,1)/distance; U(i,2) = V(i,2)/distance;

OpenStudy (anonymous):

I want to do GUI and code each button? Can I do that?

OpenStudy (anonymous):

I haven't done any MATLAB GUI. Here is the logic.

OpenStudy (anonymous):

I tried it and it doesn't work!

OpenStudy (anonymous):

Did you use my code? The code in the attached file differs from what I typed out above.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!