Question

THE QUESTION I AM SHARING WITH YOU IS THE QUESTION FROM THE SUBJECT ELECTROMAGNETICS IN THIS...

THE QUESTION I AM SHARING WITH YOU IS THE QUESTION FROM THE SUBJECT ELECTROMAGNETICS IN THIS QUESTION WE HAVE TO USE MATLAB PLEASE COMMENT EACH STEP AND DO YOUR BEST TO SLOVE IT

Question2: [5 marks]

Use MATLAB to write a generic program to find “E” at point P (x1, y1, z1) in free space due to the following charge distributions: point charge, A nC, at point P (x2, y2, z2) in free space; uniform line charge density, B nC/m, at x = t, y = t1; uniform surface charge density, C nC/m2 at x = t2.
Where A, B, C, x1, y1, z1 x2, y2, z2, t, t1& t2 can take any arbitrary value from real numbers

0 0
Add a comment Improve this question Transcribed image text
Answer #1

If you have any doubts , ask me in comment section.

Let's take this example :

Code :

OUTPUT :

RAW_CODE :

A = input('A :'); %taking inputs from user
B = input('B :');
C = input('C :');
x1 = input('x1 :');
y1 = input('y1 :');
z1 = input('z1 :');
x2 = input('x2 :');
y2 = input('y2 :');
z2 = input('z2 :');
t = input('t :');
t1 = input('t1 :');
t2 = input('t2 :');
point = [x1,y1,z1];
%point charge
q = A*10^-9; %given values
epsi = 8.85*10^-12;
p = [x2,y2,z2];
r_r0 = point - p;
magni = sum(r_r0.^2)^1.5; %calculating |r-r0|^3
Eq = q/(4*pi*epsi*magni) .*r_r0; %given formula
fprintf('Eq = %fax %fay %faz c/m^2\n',Eq(1),Eq(2),Eq(3)); %printing

%line charge
pl = B*10^-9;
pp = [t,t1,z1];
a = point - pp;
b = sqrt(sum(a.^2)); %calculating |[4,0,3]-0,2,3]|
ap = a./b;
p = b;
El = pl/(2*pi*epsi*p) .*ap; %given formula
fprintf('El = %fax %fay +%faz c/m^2\n',El(1),El(2),El(3));

%surface charge
ps = C*10^-9;
Evol = ps/(2*epsi); %given formula
fprintf('Ev = %fax\n',Evol);
Ev = [Evol,0,0];


%total charge
E = Eq .+ El .+ Ev;

%printing with x,y,z components
fprintf("\nE = %fax %fay %faz V/m\n",E(1),E(2),E(3))


Practical_calculations :

Add a comment
Know the answer?
Add Answer to:
THE QUESTION I AM SHARING WITH YOU IS THE QUESTION FROM THE SUBJECT ELECTROMAGNETICS IN THIS...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT