# Lecture 1 Matlab Exercise

## Presentation on theme: "Lecture 1 Matlab Exercise"— Presentation transcript:

Lecture 1 Matlab Exercise
Lee-Kang Lester Liu

Problem M2.1 M2.1 : write a Matlab Program to generate the conjugate-symmetric and conjugate-anti-symmetric parts of a finite-length complex sequence.

Problem M2.1 M2.1 : write a Matlab Program to generate the conjugate-symmetric and conjugate-anti-symmetric parts of a finite-length complex sequence. What are conjugate-symmetric and conjugate-anti-symmetric ?

Problem M2.1 M2.1 : write a Matlab Program to generate the conjugate-symmetric and conjugate-anti-symmetric parts of a finite-length complex sequence. What are conjugate-symmetric and conjugate-anti-symmetric ? Conjugate-symmetric : 𝑥 𝑒 𝑛 = 𝑥 𝑒 ∗ −𝑛 Conjugate-anti-symmetric : 𝑥 𝑜 𝑛 = −𝑥 𝑜 ∗ −𝑛 Where * denotes complex conjugate.

Problem M2.1 M2.1 : write a Matlab Program to generate the conjugate-symmetric and conjugate-anti-symmetric parts of a finite-length complex sequence. Any sequence 𝑥 𝑛 can be expressed as a sum of conjugate-symmetric and conjugate-anti-symmetric sequences.

Problem M2.1 M2.1 : write a Matlab Program to generate the conjugate-symmetric and conjugate-anti-symmetric parts of a finite-length complex sequence. Any sequence 𝑥 𝑛 can be expressed as a sum of conjugate-symmetric and conjugate-anti-symmetric sequences. 𝑥 𝑛 = 𝑥 𝑒 𝑛 + 𝑥 𝑜 𝑛

Problem M2.1 M2.1 : write a Matlab Program to generate the conjugate-symmetric and conjugate-anti-symmetric parts of a finite-length complex sequence. Any sequence 𝑥 𝑛 can be expressed as a sum of conjugate-symmetric and conjugate-anti-symmetric sequences. 𝑥 𝑛 = 𝑥 𝑒 𝑛 + 𝑥 𝑜 𝑛 Therefore 𝑥 𝑒 𝑛 = 1 2 𝑥 𝑛 + 𝑥 ∗ −𝑛 = 𝑥 𝑒 ∗ −𝑛 Conjugate-symmetric

Problem M2.1 M2.1 : write a Matlab Program to generate the conjugate-symmetric and conjugate-anti-symmetric parts of a finite-length complex sequence. Any sequence 𝑥 𝑛 can be expressed as a sum of conjugate-symmetric and conjugate-anti-symmetric sequences. 𝑥 𝑛 = 𝑥 𝑒 𝑛 + 𝑥 𝑜 𝑛 Therefore 𝑥 𝑒 𝑛 = 1 2 𝑥 𝑛 + 𝑥 ∗ −𝑛 = 𝑥 𝑒 ∗ −𝑛 Conjugate-symmetric 𝑥 𝑜 𝑛 = 1 2 𝑥 𝑛 − 𝑥 ∗ −𝑛 =− 𝑥 𝑜 ∗ −𝑛 Conjugate-anti-symmetric

Problem M2.1 M2.1 : write a Matlab Program to generate the conjugate-symmetric and conjugate-anti-symmetric parts of a finite-length complex sequence. Matlab Exercise Given x[n] = 2𝛿 𝑛 + 3−𝑖 𝛿 𝑛− 𝑖 𝛿 𝑛− 𝑖 𝛿 𝑛−3 + −2+3𝑖 𝛿 𝑛−4 +5𝛿 𝑛−5

Question ?

Problem M2.2 M2.2 : (a) Using program 2_2, generate the sequence shown in Figure 2.23 and 2.24. (b) Generate and plot the complex exponential sequence −2.7 𝑒 −0.4+ 𝑗𝜋 6 𝑛 for 0≤𝑛≤82 using program 2_2.

Problem M2.2(a) M2.2 : (a) Using program 2_2, generate the sequence shown in Figure 2.23 and 2.24. (b) Generate and plot the complex exponential sequence −2.7 𝑒 −0.4+ 𝑗𝜋 6 𝑛 for 0≤𝑛≤82 using program 2_2.

Problem M2.2(a) M2.2 : (a) Using program 2_2, generate the sequence shown in Figure 2.23 and 2.24. (b) Generate and plot the complex exponential sequence −2.7 𝑒 −0.4+ 𝑗𝜋 6 𝑛 for 0≤𝑛≤82 using program 2_2. Index from 0 to 40 A sequence x[n] = 𝑒 − 𝑗𝜋 6 𝑛

Problem M2.2(a) M2.2 : (a) Using program 2_2, generate the sequence shown in Figure 2.23 and 2.24. (b) Generate and plot the complex exponential sequence −2.7 𝑒 −0.4+ 𝑗𝜋 6 𝑛 for 0≤𝑛≤82 using program 2_2.

Problem M2.2(a) M2.2 : (a) Using program 2_2, generate the sequence shown in Figure 2.23 and 2.24. (b) Generate and plot the complex exponential sequence −2.7 𝑒 −0.4+ 𝑗𝜋 6 𝑛 for 0≤𝑛≤82 using program 2_2. Index from 0 to 30 𝑥 𝑛 = 𝑛 3. 𝑥 𝑛 = 𝑛

Problem M2.2(b) M2.2 : (a) Using program 2_2, generate the sequence shown in Figure 2.23 and 2.24. (b) Generate and plot the complex exponential sequence −2.7 𝑒 −0.4+ 𝑗𝜋 6 𝑛 for 0≤𝑛≤82 using program 2_2.

Question ?

Problem M2.5 M2.5 : Using Matlab to verify the result of Example 2.15.

Problem M2.5 M2.5 : Using Matlab to verify the result of Example 2.15.
Consider three sequence generated by uniformly sampling the three cosine functions of frequencies 3Hz, 7Hz, 13Hz, respectively: 𝑔 1 𝑡 =𝑐𝑜𝑠 6𝜋𝑡 𝑠𝑒𝑐 , 𝑔 2 𝑡 =𝑐𝑜𝑠 14𝜋𝑡 𝑠𝑒𝑐 , 𝑔 3 𝑡 =cos⁡ 26𝜋𝑡 𝑠𝑒𝑐 with sampling rate 𝐹 𝑇 =10𝐻𝑧 , that is , 𝑇=0.1(sec⁡)

Problem M2.5 M2.5 : Using Matlab to verify the result of Example 2.15.
Consider three sequence generated by uniformly sampling the three cosine functions of frequencies 3Hz, 7Hz, 13Hz, respectively: 𝑔 1 𝑡 =𝑐𝑜𝑠 6𝜋𝑡 𝑠𝑒𝑐 , 𝑔 2 𝑡 =𝑐𝑜𝑠 14𝜋𝑡 𝑠𝑒𝑐 , 𝑔 3 𝑡 =cos⁡ 26𝜋𝑡 𝑠𝑒𝑐 with sampling rate 𝐹 𝑇 =10𝐻𝑧 , that is , 𝑇=0.1(sec⁡) Using Eq 2.63 and Eq 2.63 𝑥 𝑛 =𝐴𝑐𝑜𝑠 2𝜋 𝑓 0 𝑛𝑇

Problem M2.5 M2.5 : Using Matlab to verify the result of Example 2.15.
Consider three sequence generated by uniformly sampling the three cosine functions of frequencies 3Hz, 7Hz, 13Hz, respectively: 𝑔 1 𝑡 =𝑐𝑜𝑠 6𝜋𝑡 𝑠𝑒𝑐 , 𝑔 2 𝑡 =𝑐𝑜𝑠 14𝜋𝑡 𝑠𝑒𝑐 , 𝑔 3 𝑡 =cos⁡ 26𝜋𝑡 𝑠𝑒𝑐 with sampling rate 𝐹 𝑇 =10𝐻𝑧 , that is , 𝑇=0.1(sec⁡) Using Eq 2.63 and Eq 2.63 𝑥 1 𝑛 =𝑐𝑜𝑠 0.6𝜋𝑛+2𝜋𝑘 𝑥 2 𝑛 =𝑐𝑜𝑠 1.4𝜋𝑛+2𝜋𝑘 𝑥 3 𝑛 =𝑐𝑜𝑠 2.6𝜋𝑛+2𝜋𝑘

Problem M2.5 M2.5 : Using Matlab to verify the result of Example 2.15.
Consider three sequence generated by uniformly sampling the three cosine functions of frequencies 3Hz, 7Hz, 13Hz, respectively: 𝑔 1 𝑡 =𝑐𝑜𝑠 6𝜋𝑡 𝑠𝑒𝑐 , 𝑔 2 𝑡 =𝑐𝑜𝑠 14𝜋𝑡 𝑠𝑒𝑐 , 𝑔 3 𝑡 =cos⁡ 26𝜋𝑡 𝑠𝑒𝑐 with sampling rate 𝐹 𝑇 =10𝐻𝑧 , that is , 𝑇=0.1(sec⁡) Using Eq 2.63 and Eq 2.63 𝑥 1 𝑛 =𝑐𝑜𝑠 0.6𝜋𝑛+2𝜋𝑘 = cos 0.6𝜋𝑛 where 𝑘=0 𝑥 2 𝑛 =𝑐𝑜𝑠 1.4𝜋𝑛+2𝜋𝑘 =𝑐𝑜𝑠 −0.6𝜋𝑛 where 𝑘=−1 𝑥 3 𝑛 =𝑐𝑜𝑠 2.6𝜋𝑛+2𝜋𝑘 =𝑐𝑜𝑠 0.6𝜋𝑛 where 𝑘=−1

Question ?

Problem M3.1 M3.1 : Determine and plot the real and imaginary parts and the magnitude and phase spectra of the following DTFT for various value of 𝛾 and 𝜃. 𝐺 𝑒 𝑗𝜔 = 1 1−2𝛾 𝑐𝑜𝑠𝜃 𝑒 −𝑗𝜔 + 𝛾 2 𝑒 −2𝑗𝜔 0<𝛾<1

Problem M3.1 M3.1 : Determine and plot the real and imaginary parts and the magnitude and phase spectra of the following DTFT for various value of 𝛾 and 𝜃. 𝐺 𝑒 𝑗𝜔 = 1 1−2𝛾 𝑐𝑜𝑠𝜃 𝑒 −𝑗𝜔 + 𝛾 2 𝑒 −2𝑗𝜔 0<𝛾<1 In z-plane , what are those roots in denominator ? 𝐺 𝑧 = 1 1−2𝛾 𝑐𝑜𝑠𝜃 𝑧 −1 + 𝛾 2 𝑧 −2 0<𝛾<1

Problem M3.1 M3.1 : Determine and plot the real and imaginary parts and the magnitude and phase spectra of the following DTFT for various value of 𝛾 and 𝜃. 𝑧= 2𝛾 𝑐𝑜𝑠𝜃 ± −2𝛾 𝑐𝑜𝑠𝜃 2 −4 𝛾 2 2 = 2𝛾 𝑐𝑜𝑠𝜃 ± 4 𝛾 2 𝑐𝑜𝑠 2 𝜃 −1 2 = 𝛾𝑐𝑜𝑠𝜃±𝛾𝑠𝑖𝑛𝜃 −1 =𝛾 𝑐𝑜𝑠𝜃±𝑗𝑠𝑖𝑛𝜃 0<𝛾<1

Problem M3.1 M3.1 : Determine and plot the real and imaginary parts and the magnitude and phase spectra of the following DTFT for various value of 𝛾 and 𝜃. 𝑧= 2𝛾 𝑐𝑜𝑠𝜃 ± −2𝛾 𝑐𝑜𝑠𝜃 2 −4 𝛾 2 2 = 2𝛾 𝑐𝑜𝑠𝜃 ± 4 𝛾 2 𝑐𝑜𝑠 2 𝜃 −1 2 = 𝛾𝑐𝑜𝑠𝜃±𝛾𝑠𝑖𝑛𝜃 −1 =𝛾 𝑐𝑜𝑠𝜃±𝑗𝑠𝑖𝑛𝜃 0<𝛾<1 Note : these roots are poles of the transfer function.

Question ?

Problem M3.3(b) M3.1 : Determine and plot the real and imaginary parts and the magnitude and phase spectra of the following DTFT. X 𝑒 𝑗𝜔 = 𝑒 −𝑗𝜔 − 𝑒 −𝑗2𝜔 − 𝑒 −𝑗3𝜔 𝑒 −𝑗𝜔 𝑒 −𝑗2𝜔 − 𝑒 −𝑗3𝜔

Problem M3.3(b) M3.1 : Determine and plot the real and imaginary parts and the magnitude and phase spectra of the following DTFT. X 𝑒 𝑗𝜔 = 𝑒 −𝑗𝜔 − 𝑒 −𝑗2𝜔 − 𝑒 −𝑗3𝜔 𝑒 −𝑗𝜔 𝑒 −𝑗2𝜔 − 𝑒 −𝑗3𝜔 Using Matlab roots function to check its zeros.!!

Question ?