Question

2- Write a MATLAB code to visualize (2D) the electric field vector due to four equal point charges Q, Placed at vertices of a

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

%we can use this code to generate the vector plot

clear all;

clc;

close all;

%Single input : define the number of points

lamda = input('Enter the charge Density in Q/m:(example "5e-9" , which is 5nC)');

%

l = input('Enter the edge length of visulatiztion box centerd at wire,in meters (example "1" which is 1 meter:)'); %created a 2D mesh resolution = 0.1 ;% default of 0.1meters [x,y] = meshgrid(-1*l/2:resolution:l/2,-1*l/2:resolution:l/2) ;

eps0 = 8.854*1e-12;

%no create a 2D array with field flux values

% magnitude of electric field due to infinite line = lamda/(2*pi*r*eps0) ;

r = sqrt(x.^2+y.^2);

theta = ((atan(y./x)).(x>=0)) + ((pi+atan(y./x)).(x<0));

E = lamda./(2*pi.*r.*eps0) ;

%compute components Ex = E.*cos(theta); Ey = E.*sin(theta);

%plot the 2D flux of filed lines contour(x,y,E);

hold on;

quiver(x,y,Ex,Ey);

hold off;

grid on;

xlabel('x') ylabel('y') title('Electric field line vector plot ')

%*****

%sample run :

Enter the charge Density in Q/m:(example "5e-9" , which is 5nC)5e-9

Enter the edge length of visulatiztion box centerd at wire,in meters (example "1" which is 1 meter:)1

Electric field ine wector plot

Add a comment
Know the answer?
Add Answer to:
2- Write a MATLAB code to visualize (2D) the electric field vector due to four equal point charge...
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
  • Three equal point charges, each with charge 1.10 , are placed at the vertices of an...

    Three equal point charges, each with charge 1.10 , are placed at the vertices of an equilateral triangle whose sides are of length 0.350 . What is the electric potential energy of the system? (Take as zero the potential energy of the three charges when they are infinitely far apart.) Use = 8.85×10−12 for the permittivity of free space.

  • Three equal point charges, each with charge 1.20 μC , are placed at the vertices of...

    Three equal point charges, each with charge 1.20 μC , are placed at the vertices of an equilateral triangle whose sides are of length 0.700 m . What is the electric potential energy U of the system? (Take as zero the potential energy of the three charges when they are infinitely far apart.) Use ϵ0 = 8.85×10−12 C2N⋅m2 for the permittivity of free space.

  • Three equal point charges, each with charge 1.35 μC , are placed at the vertices of...

    Three equal point charges, each with charge 1.35 μC , are placed at the vertices of an equilateral triangle whose sides are of length 0.250 m . What is the electric potential energy U of the system? (Take as zero the potential energy of the three charges when they are infinitely far apart.) Use ϵ0 = 8.85×10−12 C2N⋅m2 for the permittivity of free space. U = ______________ J

  • 2. Write a MATLAB program to compute Electric Field due to N multiple charges. Show the...

    2. Write a MATLAB program to compute Electric Field due to N multiple charges. Show the relevant theory, calculated example for one point charge (verify by MATLAB), and MATLAB calculation for N point charges. Use MATLAB to plot 3D potential plot around a single and multiple point charges.

  • BME 2013 Spring 2019 Exam 3 Matlab Review Sheet 1. Given the vector of patient body temperatures ...

    can anyone help me figure out how fo write matlab code for these problems? BME 2013 Spring 2019 Exam 3 Matlab Review Sheet 1. Given the vector of patient body temperatures T (98.6, 102, 101, 99,98.9, 102.1, 100.3, 101.2, 98.4 97.6, 100] use conditional statements and loops to write a program that determines and displays (using the fprintf function) the number of patients with a fever and patients without a fever. The program must ask the user to input the...

  • Three equal point charges, each with charge 1.05 μC , are placed at the vertices of...

    Three equal point charges, each with charge 1.05 μC , are placed at the vertices of an equilateral triangle whose sides are of length 0.300 m . What is the electric potential energy U of the system? (Take as zero the potential energy of the three charges when they are infinitely far apart.) Use ϵ0 = 8.85×10−12 C2/N⋅m2 for the permittivity of free space. Answer in J

  • Three equal point charges, each with charge 1.40 μC , are placed at the vertices of...

    Three equal point charges, each with charge 1.40 μC , are placed at the vertices of an equilateral triangle whose sides are of length 0.700 m . What is the electric potential energy U of the system? (Take as zero the potential energy of the three charges when they are infinitely far apart.) Use ϵ0 = 8.85×10−12 C2N⋅m2 for the permittivity of free space. Answer: U = _______________ J

  • When a single charge q is placed on one corner of a square, the electric field...

    When a single charge q is placed on one corner of a square, the electric field at the center of the square is F/q. If three other equal charges are placed on the other corners, the electric field at the center of the square due to these four equal charges is zero. Why is it zero? Show work and or explain.

  • I need matlab code of the following problem. 1. Plot the values of electric field around...

    I need matlab code of the following problem. 1. Plot the values of electric field around a positive charge in free space in two dimensions..... I need the code asap. please.

  • Three equal point charges, each with charge 1.75 mu C, are placed at the vertices of...

    Three equal point charges, each with charge 1.75 mu C, are placed at the vertices of an equilateral triangle whose sides are of length 0.550 m. What is the electric potential energy U of the system? (Take as Zero the potential energy of the three charges when they are infinitely far apart) Use epsilon_0=8.85 times 10^-12 C^2/N middot m^2 for the permittivity of free space. U = J

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