Silahkan Di Copy ;)-1.docx

  • Uploaded by: David Satria
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Silahkan Di Copy ;)-1.docx as PDF for free.

More details

  • Words: 1,302
  • Pages: 9
1. Algoritma Discrete Fourier Transform (DFT) a. Menuliskan function Xk=dft(xn) b. Membuat input matriks xn c. Mendefinisikan matriks [N,M]=size(xn) d. Melakukan keputusan if M~=1 e. Mendefinisikan xn=xn’ dan N=M f. Membuat matriks Xk=zeros(N,1) g. Membuat iterasi n=0:N-1 h. Melakukan perulangan for k=0:N-1 i. Menghitung Xk(k+1)=exp(-j*2*pi*k*n/N)*xn 2. Algoritma Invers Discrete Fourier Transform (IDFT) a. Menuliskan function xn=idft(Xk) b. Membuat input matriks Xk c. Mendefinisikan matriks [N,M]=size(Xk) d. Melakukan keputusan if M~=1 e. Mendefinisikan Xk=Xk’ dan N=M f. Membuat matriks xn=zeros(N,1) g. Membuat iterasi n=0:N-1 h. Melakukan perulangan for k=0:N-1 i. Menghitung xn(n+1)=exp(-j*2*pi*k*n/N)*Xk j. Menghitung xn=xn/N −𝑗2𝜋𝑛𝑘/𝑁 3. 𝑋𝑘 = ∑𝑁−1 𝑛=0 𝑥(𝑛)𝑒

a. 𝑥(0) = 1 , 𝑥(1) = 0 , 𝑥(2) = −1, 𝑥(3) = 0 𝑋(0) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗0∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗0∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗0∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗0∗3/4 0 𝑋(0) = 1𝑒 + 0𝑒 0 + (−1)𝑒 0 + 0𝑒 0 𝑋(0) = 1 + 0 − 1 + 0 𝑋(0) = 0 𝑋(1) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗1∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗1∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗1∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗1∗3/4 𝑋(1) = 1𝑒 0 + 0𝑒 −𝑗∗2∗𝜋/4 + (−1)𝑒 −𝑗∗4∗𝜋/4 + 0𝑒 −𝑗∗6∗𝜋/4 𝑋(1) = 1 + 0 + 1 + 0 𝑋(1) = 2 𝑋(2) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗2∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗2∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗2∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗2∗3/4 0 𝑋(2) = 1𝑒 + 0𝑒 −𝑗∗4∗𝜋/4 + (−1)𝑒 −𝑗∗8∗𝜋/4 + 0𝑒 −𝑗∗12∗𝜋/4 𝑋(2) = 1 + 0 − 1 + 0 𝑋(2) = 0 𝑋(3) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗3∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗3∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗3∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗3∗3/4

𝑋(3) = 1𝑒 0 + 0𝑒 −𝑗∗6∗𝜋/4 + (−1)𝑒 −𝑗∗12∗𝜋/4 + 0𝑒 −𝑗∗18∗𝜋/4 𝑋(3) = 1 + 0 + 1 + 0 𝑋(3) = 2 b. 𝑥(0) = 1 , 𝑥(1) = 0 , 𝑥(2) = −1 , 𝑥(3) = −1 𝑋(0) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗0∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗0∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗0∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗0∗3/4 𝑋(0) = 1𝑒 0 + 0𝑒 0 + (−1)𝑒 0 + (−1)𝑒 0 𝑋(0) = 1 + 0 − 1 − 1 𝑋(0) = −1 𝑋(1) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗1∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗1∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗1∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗1∗3/4 0 𝑋(1) = 1𝑒 + 0𝑒 −𝑗∗2∗𝜋/4 + (−1)𝑒 −𝑗∗4∗𝜋/4 + (−1)𝑒 −𝑗∗6∗𝜋/4 𝑋(1) = 1 + 0 + 1 − 𝑖 𝑋(1) = 2 − 𝑖 𝑋(2) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗2∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗2∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗2∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗2∗3/4 𝑋(2) = 1𝑒 0 + 0𝑒 −𝑗∗4∗𝜋/4 + (−1)𝑒 −𝑗∗8∗𝜋/4 + (−1)𝑒 −𝑗∗12∗𝜋/4 𝑋(2) = 1 + 0 − 1 + 1 𝑋(2) = 1 𝑋(3) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗3∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗3∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗3∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗3∗3/4 𝑋(3) = 1𝑒 0 + 0𝑒 −𝑗∗6∗𝜋/4 + (−1)𝑒 −𝑗∗12∗𝜋/4 + (−1)𝑒 −𝑗∗18∗𝜋/4 𝑋(3) = 1 + 0 + 1 + 𝑖 𝑋(3) = 2 + 𝑖 c. 𝑥(0) = −1 , 𝑥(1) = 1 , 𝑥(2) = 1 , 𝑥(3) = 1 𝑋(0) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗0∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗0∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗0∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗0∗3/4 𝑋(0) = −1𝑒 0 + 1𝑒 0 + 1𝑒 0 + 1𝑒 0 𝑋(0) = −1 + 1 + 1 + 1 𝑋(0) = 2 𝑋(1) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗1∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗1∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗1∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗1∗3/4 0 𝑋(1) = −1𝑒 + 1𝑒 −𝑗∗2∗𝜋/4 + 1𝑒 −𝑗∗4∗𝜋/4 + 1𝑒 −𝑗∗6∗𝜋/4 𝑋(1) = −1 − 𝑖 − 1 + 𝑖 𝑋(1) = −2 𝑋(2) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗2∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗2∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗2∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗2∗3/4

𝑋(2) = −1𝑒 0 + 1𝑒 −𝑗∗4∗𝜋/4 + 1𝑒 −𝑗∗8∗𝜋/4 + 1𝑒 −𝑗∗12∗𝜋/4 𝑋(2) = −1 − 1 + 1 − 1 𝑋(2) = −2 𝑋(3) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗3∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗3∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗3∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗3∗3/4 0 𝑋(3) = −1𝑒 + 1𝑒 −𝑗∗6∗𝜋/4 + 1𝑒 −𝑗∗12∗𝜋/4 + 1𝑒 −𝑗∗18∗𝜋/4 𝑋(3) = −1 + 𝑖 − 1 − 𝑖 𝑋(3) = −2 d. 𝑥(0) = −1, 𝑥(1) = 0 , 𝑥(2) = 1 , 𝑥(3) = 2 𝑋(0) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗0∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗0∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗0∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗0∗3/4 0 𝑋(0) = −1𝑒 + 0𝑒 0 + 1𝑒 0 + 2𝑒 0 𝑋(0) = −1 + 0 + 1 + 2 𝑋(0) = 2 𝑋(1) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗1∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗1∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗1∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗1∗3/4 𝑋(1) = −1𝑒 0 + 0𝑒 −𝑗∗2∗𝜋/4 + 1𝑒 −𝑗∗4∗𝜋/4 + 2𝑒 −𝑗∗6∗𝜋/4 𝑋(1) = −1 + 0 − 1 + 2𝑖 𝑋(1) = −2 + 2𝑖 𝑋(2) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗2∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗2∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗2∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗2∗3/4 𝑋(2) = −1𝑒 0 + 0𝑒 −𝑗∗4∗𝜋/4 + 1𝑒 −𝑗∗8∗𝜋/4 + 2𝑒 −𝑗∗12∗𝜋/4 𝑋(2) = −1 + 0 + 1 − 2 𝑋(2) = −2 𝑋(3) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗3∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗3∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗3∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗3∗3/4 0 𝑋(3) = −1𝑒 + 0𝑒 −𝑗∗6∗𝜋/4 + 1𝑒 −𝑗∗12∗𝜋/4 + 2𝑒 −𝑗∗18∗𝜋/4 𝑋(3) = −1 + 0 − 1 − 2𝑖 𝑋(3) = −2 − 2𝑖 e. 𝑥(0) = −1, 𝑥(1) = −1, 𝑥(2) = 1, 𝑥(3) = −1 𝑋(0) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗0∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗0∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗0∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗0∗3/4 0 𝑋(0) = −1𝑒 + (−1)𝑒 0 + 1𝑒 0 + (−1)𝑒 0 𝑋(0) = −1 − 1 + 1 − 1 𝑋(0) = −2 𝑋(1) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗1∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗1∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗1∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗1∗3/4

𝑋(1) = −1𝑒 0 + (−1)𝑒 −𝑗∗2∗𝜋/4 + 1𝑒 −𝑗∗4∗𝜋/4 + (−1)𝑒 −𝑗∗6∗𝜋/4 𝑋(1) = −1 + 𝑖 − 1 − 𝑖 𝑋(1) = −2 𝑋(2) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗2∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗2∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗2∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗2∗3/4 0 𝑋(2) = −1𝑒 + (−1)𝑒 −𝑗∗4∗𝜋/4 + 1𝑒 −𝑗∗8∗𝜋/4 + (−1)𝑒 −𝑗∗12∗𝜋/4 𝑋(2) = −1 + 1 + 1 + 1 𝑋(2) = 2 𝑋(3) = 𝑥(0)𝑒 −𝑗∗2∗𝜋∗3∗0/4 + 𝑥(1)𝑒 −𝑗∗2∗𝜋∗3∗1/4 + 𝑥(2)𝑒 −𝑗∗2∗𝜋∗3∗2/4 + 𝑥(3)𝑒 −𝑗∗2∗𝜋∗3∗3/4 𝑋(3) = −1𝑒 0 + (−1)𝑒 −𝑗∗6∗𝜋/4 + 1𝑒 −𝑗∗12∗𝜋/4 + (−1)𝑒 −𝑗∗18∗𝜋/4 𝑋(3) = −1 − 𝑖 − 1 + 𝑖 𝑋(3) = −2 4. function Xk=dft(xn) xn=input('Masukan Nilai x(n)=') [N,M]=size(xn); if M~=1, xn=xn'; N=M; end Xk=zeros(N,1) n=0:N-1; for k=0:N-1 Xk(k+1)=exp(-j*2*pi*k*n/N)*xn; end a. 𝑥(0) = 1 , 𝑥(1) = 0 , 𝑥(2) = −1, 𝑥(3) = 0 >> dft Masukan Nilai x(n)=[1 0 -1 0] ans = 0.0000 + 0.0000i 2.0000 + 0.0000i 0.0000 - 0.0000i 2.0000 + 0.0000i b. 𝑥(0) = 1 , 𝑥(1) = 0 , 𝑥(2) = −1 , 𝑥(3) = −1 >> dft Masukan Nilai x(n)=[1 0 -1 -1] ans =

-1.0000 + 0.0000i 2.0000 - 1.0000i 1.0000 + 0.0000i 2.0000 + 1.0000i c. 𝑥(0) = −1 , 𝑥(1) = 1 , 𝑥(2) = 1 , 𝑥(3) = 1 >> dft Masukan Nilai x(n)=[-1 1 1 1] ans = 2.0000 + 0.0000i -2.0000 - 0.0000i -2.0000 - 0.0000i -2.0000 - 0.0000i d. 𝑥(0) = −1, 𝑥(1) = 0 , 𝑥(2) = 1 , 𝑥(3) = 2 >> dft Masukan Nilai x(n)=[-1 0 1 2] ans = 2.0000 + 0.0000i -2.0000 + 2.0000i -2.0000 - 0.0000i -2.0000 - 2.0000i e. 𝑥(0) = −1, 𝑥(1) = −1, 𝑥(2) = 1, 𝑥(3) = −1 >> dft Masukan Nilai x(n)=[-1 -1 1 -1] ans = -2.0000 + 0.0000i -2.0000 - 0.0000i 2.0000 + 0.0000i -2.0000 - 0.0000i

5. function Xk=dft(xn) xn=input('Masukan Nilai x(n)=') [N,M]=size(xn); if M~=1,

xn=xn'; N=M; end Xk=zeros(N,1) n=0:N-1; for k=0:N-1 Xk(k+1)=exp(-j*2*pi*k*n/N)*xn; end y1=abs(Xk); y2=angle(Xk); k=0:N-1 subplot(2,1,1) stem(k,y1); xlabel('k'); ylabel('Xk'); title('Magnitude plot'); subplot(2,1,2) stem(k,y2); xlabel('k'); ylabel('Xk'); title('Phase plot'); a. 𝑥(𝑛) = 1 → 0 ≤ 𝑛 ≤ 10, 𝑥(𝑛) = 0 → 𝑛 𝑙𝑎𝑖𝑛

b. 𝑥(𝑛) = 1 → 0 ≤ 𝑛 ≤ 10, 𝑥(𝑛) = −1 → 11 ≤ 𝑛 ≤ 20, 𝑥(𝑛) = 0 → 𝑛 𝑙𝑎𝑖𝑛

c. 𝑥(𝑛) = 𝑛 → 0 ≤ 𝑛 ≤ 20, 𝑥(𝑛) = 0 → 𝑛 𝑙𝑎𝑖𝑛

d. 𝑥(𝑛) = 𝑛 → 0 ≤ 𝑛 ≤ 10, 𝑥(𝑛) = 20 − 𝑛 → 11 ≤ 𝑛 ≤ 20, 𝑥(𝑛) = 0 → 𝑛 𝑙𝑎𝑖𝑛

e. 𝑥(𝑛) = cos(

10𝜋𝑛 11

) → 0 ≤ 𝑛 ≤ 10, 𝑥(𝑛) = 0 → 𝑛 𝑙𝑎𝑖𝑛

9𝜋𝑛

f. 𝑥(𝑛) = cos( 11 ) → 0 ≤ 𝑛 ≤ 10, 𝑥(𝑛) = 0 → 𝑛 𝑙𝑎𝑖𝑛

Related Documents


More Documents from "Franchezca Enriquez"