BAB IV TRANSFORMASI FOURIER DISKRIT clc; close all; clear all; L =5; N = 40; k = [-N/2:N/2]; n = 0:N-1; xn = [ones(1,L), zeros(1,N-L)]; Xk = dft(xn,N); magXk = abs([Xk(N/2+1:N) Xk(1:N/2+1)]); subplot '211'; stem(n,xn); xlabel('n'); ylabel('xn)') title ('sinyal xn') subplot '212'; stem(k,magXk); xlabel('k'); ylabel('Xtilde(k)') title ('DFT of SQ. vave: L=5, N=40') figure; L =6; N = 60; k = [-N/2:N/2]; n = 0:N-1; xn = [ones(1,L), zeros(1,N-L)]; Xk = dft(xn,N); magXk = abs([Xk(N/2+1:N) Xk(1:N/2+1)]); subplot '211'; stem(n,xn); xlabel('n'); ylabel('xn)') title ('sinyal xn') subplot '212'; stem(k,magXk); xlabel('k'); ylabel('Xtilde(k)') title ('DFT of SQ. vave: L=6, N=60') figure; L =7; N = 80; k = [-N/2:N/2]; n = 0:N-1; xn = [ones(1,L), zeros(1,N-L)]; Xk = dft(xn,N); magXk = abs([Xk(N/2+1:N) Xk(1:N/2+1)]); subplot '211'; stem(n,xn); xlabel('n'); ylabel('xn)') title ('sinyal xn') subplot '212'; stem(k,magXk); xlabel('k'); ylabel('Xtilde(k)') title ('DFT of SQ. vave: L=7, N=80') figure; L =8; N = 100; k = [-N/2:N/2]; n = 0:N-1; xn = [ones(1,L), zeros(1,N-L)]; Xk = dft(xn,N); magXk = abs([Xk(N/2+1:N) Xk(1:N/2+1)]); subplot '211'; stem(n,xn); xlabel('n'); ylabel('xn)') title ('sinyal xn') subplot '212'; stem(k,magXk); xlabel('k'); ylabel('Xtilde(k)') title ('DFT of SQ. vave: L=8, N=100') %PERCOBAAN 2 iqbal n = 0:1:49; x = n.*exp(-0.3*n); n1 = [0:24]; y1=x(1:1:25); subplot '221'; stem(n1,y1); title 'Sinyal xn 0<=n<=24';xlabel 'n2'; Y1 = dft(y1,25); magY1 = abs(Y1(1:1:13)); k1 = 0:1:12; w1 = 2*pi/25*k1; subplot '222'; plot(w1/pi,magY1); title 'Magnitud Y1 iqbal'; xlabel 'frequency in pi unit'; n2 = [0:1:49]; y2 = [x(1:1:25) zeros(1,25)]; subplot '223'; stem(n2,y2); title 'Sinyal xn 0<=n<=24+25 iqbal'; xlabel 'n2'; Y2 = dft(y2,50); magY2=abs(Y2(1:1:26)); k2 = 0:1:25; w2 = 2*pi/50*k2; subplot '224'; plot(w2/pi,magY2); title 'Magnitud Y2 iqbal'; xlabel 'frequency in pi unit'; figure; n = 0:1:99; x = n.*exp(-0.3*n); n1 = [0:24]; y1=x(1:1:25); subplot '221'; stem(n1,y1); title 'Sinyal x 0<=n<=24';xlabel 'n2'; Y1 = dft(y1,25); magY1 = abs(Y1(1:1:13)); k1 = 0:1:12; w1 = 2*pi/25*k1; subplot '222'; plot(w1/pi,magY1); title 'Magnitud Y1 iqbal'; xlabel 'frequency in pi unit'; n2 = [0:1:99]; y2 = [x(1:1:25) zeros(1,75)]; subplot '223'; stem(n2,y2); title 'Sinyal x 0<=n<=24+75 iqbal'; xlabel 'n2'; Y2 = dft(y2,100); magY2=abs(Y2(1:1:26)); k2 = 0:1:25; w2 = 2*pi/100*k2; subplot '224'; plot(w2/pi,magY2); title 'Magnituda Y2 iqbal'; xlabel 'frequency in pi unit';