Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

[EEN 

330‐HOMEWORK 3‐PART1 SOLUTION] Dr. M. Bou Sanayeh 
 
Problem 3.3 

%Problem 3.3
%Program to find the vector between two arbitrary points in the
%Cartesian coordinate system

clear
clc

P=input('Enter the coordinates [x1,y1,z1] of the first point: ')


Q=input('Enter the coordinates [x2,y2,z2] of the second point: ')

disp('The vector components from first to second point [Ax, Ay, Az] of
R_PQ=Axax+Ayay+Azay are:')
V=P-Q;
disp(V)

In Command Window 

Enter the coordinates [x1,y1,z1] of the first point: [2,3,4]

P =

2 3 4

Enter the coordinates [x2,y2,z2] of the second point: [5,4,6]

Q =

5 4 6

The vector components from first to second point [Ax, Ay, Az] of
R_PQ=Axax+Ayay+Azay are:
-3 -1 -2

>>

Page 1 of 18 
 
[EEN 330‐HOMEWORK 3‐PART1 SOLUTION] Dr. M. Bou Sanayeh 
 
Problem 3.4 

Page 2 of 18 
 
[EEN 330‐HOMEWORK 3‐PART1 SOLUTION] Dr. M. Bou Sanayeh 
 
Problem 3.6 

Page 3 of 18 
 
[EEN 330‐HOMEWORK 3‐PART1 SOLUTION] Dr. M. Bou Sanayeh 
 
Problem 3.8 

Page 4 of 18 
 
[EEN 330‐HOMEWORK 3‐PART1 SOLUTION] Dr. M. Bou Sanayeh 
 
Problem 3.11 

Page 5 of 18 
 
[EEN 330‐HOMEWORK 3‐PART1 SOLUTION] Dr. M. Bou Sanayeh 
 
Problem 3.15 

Page 6 of 18 
 
[EEN 330‐HOMEWORK 3‐PART1 SOLUTION] Dr. M. Bou Sanayeh 
 
Problem 3.16 

Page 7 of 18 
 
[EEN 330‐HOMEWORK 3‐PART1 SOLUTION] Dr. M. Bou Sanayeh 
 
Problem 3.19 

Page 8 of 18 
 
[EEN 330‐HOMEWORK 3‐PART1 SOLUTION] Dr. M. Bou Sanayeh 
 
Problem 3.20 

Problem 3.25 

Page 9 of 18 
 
[EEN 330‐HOMEWORK 3‐PART1 SOLUTION] Dr. M. Bou Sanayeh 
 

Problem 3.29 

Problem 3.30 

Page 10 of 18 
 
[EEN 330‐HOMEWORK 3‐PART1 SOLUTION] Dr. M. Bou Sanayeh 
 
Problem 3.32 

clear
%inital variables
a=2; %cm

R=[0:0.001:8];

for k=1:length(R)
if R(k)<=a %first region
D(k)=2*R(k)^2;
else
D(k)=(2*a^3)/R(k);
end
end
plot(R,D)ylabel('Magnitude of the electric flux density
(nC/cm^2)'),xlabel('Radial distance(cm)')
axis ([0 8 -2 14])
grid

Page 11 of 18 
 
[EEN 330‐HOMEWORK 3‐PART1 SOLUTION] Dr. M. Bou Sanayeh 
 
Problem 3.33 

Î MATLAB code on next page

Page 12 of 18 
 
[EEN 330‐HOMEWORK 3‐PART1 SOLUTION] Dr. M. Bou Sanayeh 
 
clear
%inital variables
a=0.04; %m
b=0.05; %m

R=[0:1e-4:0.1];

for k=1:length(R)
if R(k)<=a %GS1
D(k)=0;
elseif R(k)<=b; %GS2
D(k)=(3/(2*pi*R(k)))*((R(k)^2-a^2)/(b^2-a^2));
else %GS3
D(k)=3/(2*pi*R(k));
end
end
plot(R,D),ylabel('Magnitude of the electric flux density
(nC/m^2)'),xlabel('Radial distance(m)')
axis ([0 0.1 -2 10]),grid

Page 13 of 18 
 
[EEN 330‐HOMEWORK 3‐PART1 SOLUTION] Dr. M. Bou Sanayeh 
 
Problem 3.38 

Problem 3.39 

Page 14 of 18 
 
[EEN 330‐HOMEWORK 3‐PART1 SOLUTION] Dr. M. Bou Sanayeh 
 
Problem 3.40 

Page 15 of 18 
 
[EEN 330‐HOMEWORK 3‐PART1 SOLUTION] Dr. M. Bou Sanayeh 
 
Problem 3.42 

Problem 3.44 

Page 16 of 18 
 
[EEN 330‐HOMEWORK 3‐PART1 SOLUTION] Dr. M. Bou Sanayeh 
 
Problem 3.45 

Problem 3.47 

Page 17 of 18 
 
[EEN 330‐HOMEWORK 3‐PART1 SOLUTION] Dr. M. Bou Sanayeh 
 
Problem 3.49 

Page 18 of 18 
 

You might also like