Reference no: EM133023974
Function: visualize the cross products of two vectors A and B in the 3D % space
% Input: A and B, 3 x 1 vectors in rectangular coordinates
A_B=cross(A,B); % Compute the cross product of A and B
B_A=cross(B,A); % Compute the cross product of B and A
Introduction
This laboratory component introduces students to the simulation and practical applications of the concepts and techniques in ECTE213 Engineering Electromagnetics. The labs are based on MATLAB and Partial Differential Equation toolbox. Through this laboratory program, students are expected to be able to solve basic electromagnetic problems and visualize the results effectively.
• Lab 1: Vector Analysis and Fields
• Lab 2: Electrostatics
• Lab 3: Waves in Free Space and Dielectrics
• Lab 4: Rectangular Waveguides
• Lab 5: Radiation and Antennas
Exercise 0.1: What are the purposes of the MATLAB commands? Record your answers in your logbook.
abs, angle, imag, cos, size, cross, gradient
Exercise 0.2: Review the basic operations by trying the following in the MATLAB command window. Fill in the missing commands and comments (on the functionality of the line of command).
X = rand(2,4) % generate a random matrix with entries uniformly
% distributed in [0,1]
Y = rand(size(X)) % ________________________________________________
Z = X + j*Y % generate a matrix Z whose real part is equal to X and
% imaginary part is equal to Y
Z1 = Z(1,:) % ________________________________________________
T = 2*exp(Z1) + 5 % ________________________________________________
__________________ % find the magnitudes of the all the entries of T
__________________ % find the phase angles of the all the entries of T
Exercise 0.2: Continue from the above example. Try the following in the command window. Observe and explain the error messages, if any.
B = A(:, 1:2) % B is defined as a subblock of A
C = B' % C is the conjugate transpose of B
D = C*B % D is the product of C and B
E = C.*C % E is the element-by-element product of C
% and itself
C*C
C.*B
Lab 1: Vector Fields
1.1 Introduction
The objectives of this lab are:
• learn how to use MATLAB commands and M-files to manipulate vectors and their operations;
• learn how to simulate and visualize simple electric fields.
1.6 Lab Tasks
Task 1.1: Vector Analysis
a) We are given the following two vectors represented in rectangular coordinates and spherical coordinates, respectively
x = 2ax +3ay + 4az
y = 2ar + 3aθ +4aΦ (r = 2, θ=3, Φ =4, in radian
Use MATLAB to find their dot product and cross product, and represent the results in the rectangular coordinate system.
b) There is a two dimensional (2D) vector field defined by
g(x, y) = cos(0.1Πx)ax + cos(0.1Πy)ay
Write a MATLAB script using the quiver and contour commands to visualize the field and its divergence. Assume the region of interest to be -20 ≤ x ≤ 20, -40 ≤ y ≤ 40.
Task 1.2:
Electric Field of Dipoles
a) Two point charges with Q1 = Q2 = 1 C are placed at (x0, y0, z0) = (-1,0 ,0) and (x1, y1, z1) = (1, 0, 0) in free space. Write down an expression for the electric potential function V(x, y, z).
b) Write a MATLAB script to find and visualize the electric field of Task 1.2.a in the 3D space and on the y-z plane (x=0).
c) Assume that the charge at (x0, y0, z0) = (-1, 0, 0) is changed to Q1 = -1C, repeat the task in Task 1.2.b.
Lab 2: Electrostatics
2.1 Introduction
The objectives of this lab are:
• learn how to use MATLAB commands and M-files to solve boundary value problems using finite difference method (FDM);
• learn how to use the MATLAB Partial Differential Equation Toolbox (based on finite element method (FEM)) to solve Poisson's equation with boundary conditions.
Exercise 2.1: Run the FDM_demo.m to view the above processes. Then solve the problem in Fig. 2.2 with new boundary conditions Vu = 100, Vl = 20, Vr = 20. Vb = -10
Exercise 2.2: Read the material in Lecture 5 to learn the basic principles of FEM.
The MATLAB PDE toolbox provides a useful graphic user interface (GUI) to solve different types of partial differential equations using FEM, including the Poisson's equation and the Laplace equation in studying static electric fields.
Exercise 2.3: Simulate the field in Example 2.2, letting the radius of the inner and outer circles to be 0.2 and 0.6, and their potentials to be 200 and 400. Assume ∈ =1. ρ =0. Change the resolution of the meshing grids.
Compare the results and computational time. Note that the two circles must have the same centre to simulate a coaxial cable
Task 2.1:
Use MATLAB to implement the finite difference method (FDM) to find the electric potential for the following source-free squared region using 4 x 4 grids.
Task 2.2:
The figure below aims to simulate a two-wire transmission. Two solid metallic (ideal conductors) wires with the given sizes are contained in a rectangular region with zero charge density. The geometry is specified in Fig. 2.4
Use the PDE Toolbox to solve for the electric field shown above. Assume ∈ =1. ρ =0.
a) Set the problem in the PDE Toolbox.
Hint: The center of the rectangular (R1) can be set to (0,0), the width of R1 is 0.55*2=1.1; the center of the left circle (E1) is (-0.35,0). Set the region formula to be R1-E1-E2.
b) Visualize the potential field and the electric field.
Lab 3: Waves in Free Space and Dielectrics
3.1 Introduction
The objectives of this lab are:
• learn how to use MATLAB commands and M-files to solve and characterize uniform plane waves (i.e.,
transverse electromagnetic (TEM) waves);
• learn how to use the MATLAB to analyze and visualize wave reflection and transmission.
Task 3.1:
a) Modifying the TEM_Lossy.m demo file, use MATLAB to demonstrate the E and H fields of a TEM wave in a lossy material with a frequency of 100MHz and μr = 1 ∈'r = 50, ∈"r = 10. Assume that the E field is polarized in the x direction with peak value of 10-4 V/m observed at t =0, z = 0. You need to plot the E and H field distributions at t = T/15 for points on the z axis from to z = 0 to z = 10λ.
b) Use MATLAB to demonstrate the pattern of the following polarized waves and determine its polarization type, i.e., linear polarization, circular polarization or elliptical polarization.
Task 3.2:
a) Following Example 3.4, change the material parameters to
μr = 1 ∈'r1 = 4, ∈"r = 0, μr2 =1, ∈r2 = 81, ∈"r2 = 0;
Observe the variations of the waves in the two materials and record the snapshots of the superimposed field in Material 1 at t = T0/10, T0/2, 3T0/4.
b) Continue from Task 3.2.a. Modify the TEM_Reflection script to produce an estimate of the standing wave ratio by measuring the E field.
Hint: Record the magnitude of the E field at and and compute their ratio.
c) Repeat the tasks in Task 3.2.a and Task 3.2.b with the following parameters:
μr = 1 ∈'r1 = 4, ∈"r = 0, μr2 =1, ∈r2 = 81, ∈"r2 = ∞;
Lab 4: Rectangular Waveguides
4.1 Introduction
The objectives of this lab are:
• learn how to use MATLAB commands and M-files to analyze and visualize the wave propagations in rectangular waveguides;
• learn how to determine parameters for rectangular waveguide with given specifications
Exercise 4.1: Modify the parameters of Example4_2_TEWave2DXY_Plot.m to
a) Compare TE01, TE10, TE22 with ∈r = 1, μr =1, a = 0.1,b =0.05, f = 2 x 1010Hz , write one or two sentences to summarize the key difference in the plots.
b) Fix ∈r = 1, μr =1, a = 0.1,b =0.05, Compare TE22 with f = 2 x 1010Hz Hz, write one or two sentences to summarize the key difference in the plots obtained.
4.3 Cutoff Frequency and Wave Propagation
Task 4.1:
(a) Complete Exercise 4.1.
(b) Modify from the function TEWave3D_VaryingTime()to generate a script to visualize the wave propagation of the following waveguide configurations:
(i) TE01, TE10, TE11, TE44 wave propagating in a rectangular waveguide at time , where is the period of the wave, and
∈r = 2, μr =1, a = 0.2, b =0.05, c = 0.1 f = 10 x 10 10 Hz
write one or two sentences to summarize the key difference in the plots.
(ii) Determine the cutoff frequencies for the modes TE01, TE10, TE11, TE44.
Task 4.2:
We have a rectangular waveguide with
a = 0.15, b = 0.05, μr = 1, ∈r = 8.
Use MATLAB scripts and commands to solve the following problems:
a) Determine the cutoff frequencies for TM11 and TM21 modes. Record them as and , respectively.
b) Produce figures similar to Fig. 4.2 to illustrate the fields of a TM11 wave with frequency ; compare the wave patterns observed with those for a TE11 wave with the same frequency .
Lab 5: Radiation and Antennas
5.1 Introduction
The objectives of this lab are:
• learn how to use MATLAB commands and M-files to simulate the radiation from current elements;
• learn how to use MATLAB to analyze, design and visualize radiation patterns of dipole antennas and uniform linear arrays (ULAs).
Exercise 5.1: Following the examples above, compare the patterns of the following dipole antennas
• f = 300MHz, l = 0.125 λ
• f = 300MHz, l = 0.25 λ,
• f = 300MHz, l = 0.5 λ,
• f = 300MHz, l = 0.6 λ,
• f = 300MHz, l = 0.75 λ,
Focus on the E-pane pattern. Record the number of mainbeams, the 3dB mainbeam width and the sidebeam level (relative to the mainbeam peak) for each case and comment on the trends of changes when is increasing.
Exercise 5.2: Following Example 5.3, use MATLAB to simulate the beampattern of a ULA.
a) set properly to form a beampattern with a peak at , keeping other conditions fixed.
b) set the number of antennas to , plot the beampatterns, and record the 3dB mainbeam widths with different numbers of antennas. Comment on the change of the mainbeam width as the number of antennas is increased.
Task 5.1:
Use MATLAB to determine the total length for a dipole antenna that has only one single mainbeam (mainlobe) in for the E-plane pattern with a 3dB beamwidth of 40o. Also find the corresponding sidebeams (sidelobe) height (in decibel) relative to the mainbeam peak.
Task 5.2:
Uniform linear antenna array (ULA) design. Assume a ULA consisting of half-wave dipoles, i.e., 2l = 0.5λ. Set the distance between neighboring antennas to to achieve directional radiation.
a) Assume ξ = 0, i.e., there is no difference in the phase of neighbouring antennas, and the 3dB mainbeam width in the H-plane pattern is no larger than 8o. Determine the minimum number of antennas needed and illustrate the antenna patterns using MATLAB similarly to Fig. 5.10.
b) Assume that the mainbeam points to Φ0 = 30° and the 3dB mainbeam width is about 10°. Specify the phase shift between neighboring antennas, determine the number of antennas, and plot the antenna pattern similarly to Fig. 5.10.
Attachment:- Engineering Electromagnetics.rar