Columb's law in Matlab

2 views (last 30 days)
Kathleen Kelly
Kathleen Kelly on 14 Feb 2019
Answered: KSSV on 14 Feb 2019
I need help starting this problem. If you know how to do this or could give me some insight as to how to do this that would be most helpful. I am hoping to solve through matrices but am unsure where to really start. I attached the problem.Matlab Question.png

Answers (1)

KSSV
KSSV on 14 Feb 2019
Actually this is an home work problem....we dont solve your home work problems.......As you have asked to give some insight and not demanded a code....I wanted to help you. I h ave quickly typed a code......your code should be more or less like this. Go throught the code , understand it and implement it in your problem.
eps0 = 8.854187817*10^-12 ;
Q0 = 3.5 ;
P0 = [1 -1 2] ;
L = 10; B = 10; H = 10 ;
m = 50 ; n = 50 ; p = 50 ;
x = linspace(-L,+L,m) ;
y = linspace(-B,+B,n) ;
z = linspace(-H,+H,p) ;
[X,Y,Z] = ndgrid(x,y,z) ;
X = X(:) ; Y = Y(:) ; Z = Z(:) ;
X0 = P0(1) ; Y0 = P0(2) ; Z0 = P0(3) ;
% GEt disatnces
R = sqrt((X0-X).^2+(Y0-Y).^2+(Z0-Z).^2) ;
Ex = Q0/(4*pi*eps0)*(X-X0)./R.^3 ;
Ey = Q0/(4*pi*eps0)*(Y-Y0)./R.^3 ;
Ez = Q0/(4*pi*eps0)*(Z-Z0)./R.^3 ;
quiver3(X,Y,Z,Ex,Ey,Ez,10)

Categories

Find more on Physics in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!