Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Electromagnatics(MATLAB) In this computer assignment, we intend to use Matlab pr

ID: 2082133 • Letter: E

Question

Electromagnatics(MATLAB)

In this computer assignment, we intend to use Matlab programming to derive both 3D and 2D plots of the electric and magnetic fields for the electric and magnetic dipoles, and repeat the same for the static and vector potentials for the two types of dipoles. Consider the electric dipole and the corresponding far-field electric field and electric potential as derived. (a) Recall the electric potential: V = q d cos theta/4 pi epsilon_0 R^2. Normalizing the potential by dividing by the dipole moment qd and multiplying with 4 pi epsilon_0, obtain a 3D plot of V vs. R and theta. Assume theta in the range (0, 2 pi) and R in the range (10, 100) measured in meters. Remember this assumes d a (say 10 m), vs. theta in the range (0, pi); and (ii) for theta = pi/4, vs. Ri(in meters) in the range (1, 100) (b) Recall the far-field flux density. B = mu_0 m/4 pi R^3 (a_R 2 cos theta + a_theta sin theta), m = I pi a^2 Generate normalized 2D plots of B_R and B_theta vs. R for the 4 values theta of 0, pi/4, pi/2 and pi, and vs. theta for the 4 values R of 10, 50, 75 and 100.

Explanation / Answer

clc;
close all;
clear all;

q = 1.6E-19;
d = 0.25;
epsilon0 = 8.85E-12;

theta = 0:0.1:2*pi;
V = [];
R = 10:1:100;

for i = 1:1:length(theta)
    for k = 1:1:length(R)
        V = (q*d*cos(theta(i)))/(4*pi*epsilon0*(R(i).^2));
        plot3(theta(i),R(i),V);
        hold on
    end
end
title('3D plot theta R V');

R = 10:1:100;

figure
theta = 0;
        V = (q*d*cos(theta))./(4*pi*epsilon0*(R.^2));
        subplot(4,1,1);
        plot(R,V);

theta = pi/4;
        V = (q*d*cos(theta))./(4*pi*epsilon0*(R.^2));
        subplot(4,1,2);
        plot(R,V);

theta = pi/2;
        V = (q*d*cos(theta))./(4*pi*epsilon0*(R.^2));
        subplot(4,1,3);
        plot(R,V);

theta = pi;
        V = (q*d*cos(theta))./(4*pi*epsilon0*(R.^2));
        subplot(4,1,4);
        plot(R,V);
title('V vs R');

theta = 0:0.1:2*pi;

figure
R = 10;
        V = (q*d*cos(theta))./(4*pi*epsilon0*(R.^2));
        %subplot(4,2,2);
        polar(theta,V);
        title('V vs theta R = 10');

figure
R = 50;
        V = (q*d*cos(theta))./(4*pi*epsilon0*(R.^2));
%         subplot(4,2,4);
        polar(theta,V);
        title('V vs theta R = 50');

figure
R = 75;
        V = (q*d*cos(theta))./(4*pi*epsilon0*(R.^2));
%         subplot(4,2,6);
        polar(theta,V);
        title('V vs theta R = 75');

figure
R = 100;
        V = (q*d*cos(theta))./(4*pi*epsilon0*(R.^2));
%         subplot(4,2,8);
        polar(theta,V);
        title('V vs theta R = 100');

%ELECTRIC FIELD
R = 10:1:100;

figure
theta = 0;
        V = (q*d*2*cos(theta))./(4*pi*epsilon0*(R.^3));
        subplot(4,2,1);
        plot(R,V);
title('Er vs R');

theta = pi/4;
        V = (q*d*2*cos(theta))./(4*pi*epsilon0*(R.^3));
        subplot(4,2,3);
        plot(R,V);

theta = pi/2;
        V = (q*d*2*cos(theta))./(4*pi*epsilon0*(R.^3));
        subplot(4,2,5);
        plot(R,V);

theta = pi;
        V = (q*d*2*cos(theta))./(4*pi*epsilon0*(R.^3));
        subplot(4,2,7);
        plot(R,V);

theta = 0;
        V = (q*d*sin(theta))./(4*pi*epsilon0*(R.^3));
        subplot(4,2,2);
        plot(R,V);
title('Etheta vs R');

theta = pi/4;
        V = (q*d*sin(theta))./(4*pi*epsilon0*(R.^3));
        subplot(4,2,4);
        plot(R,V);

theta = pi/2;
        V = (q*d*sin(theta))./(4*pi*epsilon0*(R.^3));
        subplot(4,2,6);
        plot(R,V);

theta = pi;
        V = (q*d*sin(theta))./(4*pi*epsilon0*(R.^3));
        subplot(4,2,8);
        plot(R,V);


%ER, Et vs theta      
theta = 0:0.1:2*pi;

figure
R = 10;
        V = (q*d*2*cos(theta))./(4*pi*epsilon0*(R.^3));
%         subplot(4,2,1);
        polar(theta,V);
        title('Er vs theta R = 10');

figure
R = 50;
        V = (q*d*2*cos(theta))./(4*pi*epsilon0*(R.^3));
%         subplot(4,2,3);
        polar(theta,V);
        title('Er vs theta R = 50');

figure
R = 75;
        V = (q*d*2*cos(theta))./(4*pi*epsilon0*(R.^3));
%         subplot(4,2,5);
        polar(theta,V);
        title('Er vs theta R = 75');

figure
R = 100;
        V = (q*d*2*cos(theta))./(4*pi*epsilon0*(R.^3));
%         subplot(4,2,7);
        polar(theta,V);
        title('Er vs theta R = 100');

figure
R = 10;
        V = (q*d*sin(theta))./(4*pi*epsilon0*(R.^3));
%         subplot(4,2,2);
        polar(theta,V);
        title('Etheta vs theta R = 10');

figure
R = 50;
        V = (q*d*sin(theta))./(4*pi*epsilon0*(R.^3));
%         subplot(4,2,4);
        polar(theta,V);
        title('Etheta vs theta R = 50');

figure
R = 75;
        V = (q*d*sin(theta))./(4*pi*epsilon0*(R.^3));
%         subplot(4,2,6);
        polar(theta,V);
        title('Etheta vs theta R = 75');

figure
R = 100;
        V = (q*d*sin(theta))./(4*pi*epsilon0*(R.^3));
%         subplot(4,2,8);
        polar(theta,V);
        title('Etheta vs theta R = 100');


%MAGNETIC POTENTIAL
I = 1.0E-3;
a = 1;
m = I*pi*(a.^2);
mu0 = 4*pi*1.0E-7;

R = 10:1:100;

figure
theta = 0;
        B = (mu0*m*2*cos(theta))./(4*pi*(R.^3));
        subplot(4,2,1);
        plot(R,B);
title('Br vs R');

theta = pi/4;
         B = (mu0*m*2*cos(theta))./(4*pi*(R.^3));
        subplot(4,2,3);
        plot(R,B);

theta = pi/2;
         B = (mu0*m*2*cos(theta))./(4*pi*(R.^3));
        subplot(4,2,5);
        plot(R,B);

theta = pi;
         B = (mu0*m*2*cos(theta))./(4*pi*(R.^3));
        subplot(4,2,7);
        plot(R,B);

theta = 0;
        B = (mu0*m*sin(theta))./(4*pi*(R.^3));
        subplot(4,2,2);
        plot(R,B);
title('Btheta vs R');

theta = pi/4;
        B = (mu0*m*sin(theta))./(4*pi*(R.^3));
        subplot(4,2,4);
        plot(R,B);

theta = pi/2;
        B = (mu0*m*sin(theta))./(4*pi*(R.^3));
        subplot(4,2,6);
        plot(R,B);

theta = pi;
        B = (mu0*m*sin(theta))./(4*pi*(R.^3));
        subplot(4,2,8);
        plot(R,B);

      
%Br, Btheta vs theta      
theta = 0:0.1:2*pi;

figure
R = 10;
        B = (mu0*m*2*cos(theta))./(4*pi*(R.^3));
%         subplot(4,2,1);
        polar(theta,B);
        title('Br vs theta R = 10');

figure
R = 50;
        B = (mu0*m*2*cos(theta))./(4*pi*(R.^3));
%         subplot(4,2,3);
        polar(theta,B);
        title('Br vs theta R = 50');

figure
R = 75;
        B = (mu0*m*2*cos(theta))./(4*pi*(R.^3));
%         subplot(4,2,5);
        polar(theta,B);
        title('Br vs theta R = 75');

figure
R = 100;
        B = (mu0*m*2*cos(theta))./(4*pi*(R.^3));
%         subplot(4,2,7);
        polar(theta,B);
        title('Br vs theta R = 100');

figure
R = 10;
        B = (mu0*m*sin(theta))./(4*pi*(R.^3));
        B = (mu0*m*sin(theta))./(4*pi*(R.^3));
%         subplot(4,2,2);
        polar(theta,B);
        title('Btheta vs theta R = 10');

figure
R = 50;
        B = (mu0*m*sin(theta))./(4*pi*(R.^3));
%         subplot(4,2,4);
        polar(theta,B);
        title('Btheta vs theta R = 50');

figure
R = 75;
        B = (mu0*m*sin(theta))./(4*pi*(R.^3));
%         subplot(4,2,6);
        polar(theta,B);
        title('Btheta vs theta R = 75');

figure
R = 100;
        B = (mu0*m*sin(theta))./(4*pi*(R.^3));
%         subplot(4,2,8);
        polar(theta,B);
        title('Btheta vs theta R = 100');


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote