Matlab Exercise
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Chapter Matlab Exercise
1. If P1 is (1,2,3) and P2 is (-4,0,5),find
(a) The distance P1P2
(b) The vector equation of the line P1P2
(c) The shortest distance between the line P1P2 and point P3 (7,-1,2).
2. Input two vectors and then compute their dot product, cross product, sum, and difference.
3. Input a coordinate in either rectangular, cylindrical, or spherical coordinates and retrieve the answer in the other coordinate system.
4. Input a non-variable vector in rectangular coordinates and obtain the cylindrical, or spherical components. Must enter the point location where this transformation occurs; the result depends on the vector’s observation point.
5. Compute the integral of a function using two different methods:
(1) the built-in matlab ‘quad’ function
(2) used-defined summation.
6. Find the divergence and curl of a vector field given in symbolic form .Can use the built-in symbolic derivative function called diff( ) to
compute the derivatives.
7.This script allows the user to input a number of charges and compute the electric field at a particular coordinate observation point due to these charges.
8.This script computes the results of example by numerical integration。
EXAMPLE
The finite sheet 0≤x≤1,0≤y≤1 on the z=0 plane has a charge densit y
ρs=xy(x2+y2+25)3/2nC/m2.Find
(a) The total charge on the sheet
(b)The electric field at (0,0,5)
(c)The force experienced by a -1mC charge located at (0,0,5).
9.This script computes parts(a) and (b) for Example using discrete summation approximation for the integration。
EXAMPLE
If J= (1/r3)(2cosθa r+sinθaθ)A/m2,calculate the current passing through
(a) A hemispherical shell of radius 20 cm, 0<θ<π/2, 0<φ<2π
(b)A spherical shell of radius 10 cm.
10.This script allows the user to enter an electric field on either side of a
dielectric boundary and compute the electric field on the other side of the boundary 。
The boundary is assumed to be the plane z=0, with E1 the field in the region z ≥0 and E2 the field in the region z ≤0.
inputs: E1or E2 ,er1 and er2 (the relative permittivities of both media )outputs: E1 or E2, the field not input by the user.
11. This script allows the user to specify a current directed out of the page (+z direction) that lies on the origin, is assumed infinite ,and points in the z direction and plot the vector magnetic field in the xy-plane.
input: I (value of the current), x and y limit of the plot.
output: the magnetic field vector plot.
12. This script computes the results for the example.
Example
A charged particle of mass 2kg and charge 3 C starts at point (1,-2,0) with velocity m/s in an electrical field V/m. At time t=1s,determine
(a)The acceleration of the particle
(b)Its velocity
(c)Its kinetic energy
(d)Its position
y
x a a 1012+z x a a 34+
(Note: It uses the ‘dsolve’ function which solves symbolic defferential equations, the arguments to the function are
(1)the differential equation, with D and D2 in front of the variable denoting 1st and 2nd derivative
(2)the 1st order initial value
(3)the 2nd order initial value
(4)the independent variable)
13.This scripts illustrates Matlab’s complex arithmetic abilities and assists the user to solve Practice Exercise .
Evaluate the complex numbers
14. This script assists with the solution and graphing of Example .We use symbolic variables in the creation of the waveform equation that describes the expression for the electric field.
Example
An electric field in free space is given by
(a)Find the direction of wave propagation
(b)Calculate and the time it takes to travel a distance of 0450
2
335306)(21)(j e j b j j j a +-+∠⎥⎦⎤⎢⎣⎡-+m
V a x t E y /)10cos(508β+=β2
λ
(c)Sketch the wave at t=0,T/4,and T/2. 15还有作业7-30.。