ECE3340 - CW Jan 30

your name, ID

1. ListPlot practice

Plot Cos[x] for x from 0 to 50 by making a ~500-point array. Do with an array of points instead of built-in function as shown below.

Plot[Cos[x],{x,0,50}]

Answer

2. Problem 2 - EM wave long distance

Light is electromagnetic wave, and for some, such as a laser beam, we can describe the E field as:
                                 Ef=A (e^(i (k x-ω t)))              (2.1)
where k=((2 π)/λ)=(ω/c) where λ is the wavelength of light, ω is the frequency, and c is the speed of light which is:     c=299.792458((μm)/ps)
Note: μm is micrometer = (10^(-6)) meter
         ps is picosecond = (10^(-12)) second.

Consider a laser beam shot by NASA Lunar Atmosphere and Dust Environment Explorer (LADEE) from Moon to Earth. Although its wavelength is infrared (for minimal atmospheric scattering loss), for the sake of this HW, we will consider laser wavelength be 0.5 μm (green).

If we plot the E field at a distance d, with x over a range of 5 μm at 0.02 μm step at a moment in time, we can write as follow:
                       Ef=A (e^(i (k (d+x)-ω t))) -> A Cos[k (d+x) ]   for x =0 to 5 μm.
                       λ=0.5 μm;  k=((2π)/λ); and Let A=1.

2.1 Plot E-field at source

Let d=0, plot E field.

Answer

2.2 Plot E-field at d=1000 km

Plot the field after having traveled a distance d=1000 km away from its starting position.
Note: to convert km to μm:  1 km=(10^9) μm.

Answer

2.3 Plot the E field when it reaches Earth at d = 384000 km.

d= 384000*(10^9) μm

Answer

2.4 Discussion

Is the above correct result? i. e. is that the electromagnetic field when it reaches Earth? Discuss.

Answer

2.5 Is there any difference between E field after 1000 km vs E field at the starting position?

Hint: plot xarr2 vs. ef2-ef1

Answer

2.6 What is the “Numerical-Methods”-wise correct approach?

Answer

Lecture break: mantissa, exponent, precision, accuracy

3. Problem 3 - number inside a computer

3.1 (Subscript[y, 1])= (Sqrt[(Subscript[x, 1])]), find (Subscript[x, 1])-((Subscript[y, 1])^2)

Let x1 be some number,  y1=(Sqrt[x1]), find z = x1-(y1^2).

Answer

3.2 Do 3.1 above with (Subscript[x, 1])=5.

Now, let x1=5., use computer to calculate z

x1=5. ; y1=(Sqrt[x1]);

Answer

3.3 Take (Subscript[Log, 2]) of z - discuss

Answer

3.4 Make a Table of many numbers

Make a table (array) of {x1 (integer), z=Abs[ x1-((((Sqrt[1.*x1])))^2)],  and Log[2,z]} for x1 from 0 to 50.

Answer

3.5 Obtain array {x1,z}, name it u2, and ListPlot x1 vs. z

Answer

3.6 Do the same as 3.5 but x1 from 0 to 1000000 in step of 2503 and use ListLogLogPlot

Answer

Lecture break: Binary, 64-bit float number - intro

4. Revisit Problem 2 - EM wave

2.6 What is the “Numerical-Methods”-wise correct approach?

Follow instruction

Lecture break: Floating-point - IEEE-754- detail

Home assignment (possibly) discussion

Consider this RC circuit:

Let the input be a square wave:

Plot[UnitBox[2u-0.5] /. u-> Mod[t,1],{t,0,4}
,PlotStyle-> {Thickness[0.005],Hue[0.1,1,1]}
,Filling-> {1-> {0.,Hue[0.16,1,1,0.4]}}
,Frame-> True, GridLines->Automatic
,FrameStyle->White
,FrameLabel->(Style[#,16,White,FontFamily->"Arial"] & /@ 
{"time","amplitude"})
,Background->Black,AspectRatio->0.5,ImageSize->400]

The output is: 
       (Subscript[v, out])=Π[2 t-0.5] -(e^(-(t/τ)))((1/(1+(e^(-(0.5/τ))))) -(e^(0.5/τ)) Θ[t-0.5])  for  0≤ t < 1  (2.1)
and is periodic with period of 1; τ is the RC time constant:
                        τ=((((Subscript[R, 1])+(Subscript[R, Th])) (Subscript[R, 2]))/(((Subscript[R, 1])+(Subscript[R, Th])) +  (Subscript[R, 2])))C 
For the notation of Eq. (2.1) above:
                  Π[u] is the UnitBox function
                  Θ[u] is the Heaviside UnitStep function

Below is an example of the output for τ=0.1

τ=0.1;Plot[(UnitBox[2u-0.5]- (E^(-(u/τ)))((1/(1+(E^(-(0.5/τ)))))-(E^(0.5/τ)) UnitStep[u-0.5]) /. u-> Mod[t,1]),{t,0,4} 
,PlotRange-> {0,1.1}
,PlotStyle-> {Thickness[0.005],Hue[0.35,1,1]}
,Filling-> {1-> {0.,Hue[0.3,1,1,0.4]}}
,Frame-> True, GridLines->Automatic
,FrameStyle->White
,FrameLabel->(Style[#,16,White,FontFamily->"Arial"] & /@ 
{"time","amplitude"})
,Background->Black,AspectRatio->0.5,ImageSize->400]

1. Plot the output for τ=0.01

Answer

2. Plot the output for τ=(10^(-4)), for t from 0.5 to 0.5005

You must explain your approach to get the solution.

Answer