Está en la página 1de 4

Praktikum III Kuliah Pemrosesan Sinyal

Praktikum III pemrosesan sinyal akan membahas Deret Fourier. Tujuan : Memahami penerapan Deret Fourier Memahami dampak Fenomenon Gibb

Peralatan : laptop/PC dengan matlab dan DSP toolbox. Percobaan 3.1 Prosedur : 1. Double-click Matlab/scilab 2. Buka text editor matlab (icon persegi putih, sisi kiri) atau menggunakan sembarang text editor, seperti notepad, wordpad dll. 3. Ketik command line dibawah ini %Fenomenon Gibb
t=linspace(-2,2,2000); u=linspace(-2,2,2000); sq=[zeros(1,500),2*ones(1,1000),zeros(1,500)]; k=2; N=[1,3,7,19,49,70]; for n=1:6; an=[]; for m=1:N(n) an=[an,2*k*sin(m*pi/2)/(m*pi)]; end; fN=k/2; for m=1:N(n) fN=fN+an(m)*cos(m*pi*t/2); end; nq=int2str(N(n)); subplot(3,2,n),plot(u,sq,'r','LineWidth',2);hold on; plot(t,fN,'LineWidth',2); hold off; axis([-2 2 -0.5 2.5]);grid; xlabel('Time'), ylabel('y_N(t)');title(['N= ',nq]); end;

4. Save dengan nama gibb.m; letakkan pada direktori dimana matlab dieksekusi (lihat “current folder”). Lalu run. Apa yang anda amati ? 5. Lakukan perubahan pada N=[1,3,7,19,49,70]; Apa yang terjadi ? Jelaskan mengapa ! 6. Dengan variabel N menyesuaikan (lihat langkah no.5), perpendek dan perpanjang lebar kotak pada variabel sq. Apa yang anda amati ?

'. f = f + real(Dn*exp(j*n*wo*t)). for n = 1:N(i). % start out with DC bias term for n = -N(i):-1. end.f). % increment vector index end. 3. wo = 2*pi/To. Dn(i) = D0. % fundamental period and frequency D0 = 0. % time over which we'll plot signal N = [1 5 10 50]. % clear matlab's memory figure(1). % +/. xlabel('t '). plot([-2 -1 -1 0 0 1 1 2 2 3 3 4 4]. % signal offset t = -2:0. w(i) = n*wo. % loop over positive n % Fourier coefficient % add FS terms subplot(2.2... % Fourier coefficient f = f + real(Dn*exp(j*n*wo*t)).values at which we'll truncate FS for i = 1:4. Double-click Matlab/scilab 2. % open and clear figure 1 To = 2. % add FS terms end. % loop over positive n Dn(i) = (1 . wo = 2*pi/To.exp(-j*n*pi))/(j*2*pi*n). % store associated frequency i = i + 1. ylabel('f(t)'). % signal offset. % store 0 frequency terms % increment vector index for n = 1:4. hold off. Dn = (1 . wordpad dll.5. % store associated frequency . Ketik command line dibawah ini % *** Plot truncatated FS for various numbers of terms.exp(-j*n*pi))/(j*2*pi*n). Buka text editor matlab (icon persegi putih. seperti notepad. % loop over negative n Dn(i) = (1 . % clear matlab's memory figure(2).':').exp(-j*n*pi))/(j*2*pi*n). w(i) = 0.num2str(N(i))]. % open and clear figure 2 To = 2. % loop over negative n Dn = (1 .[1 1 0 0 1 1 0 0 1 1 0 0 1]. title(titlevec). clf.Percobaan 3. % *** Plot exponential magnitude and phase spectra for 1st 4 harmonics clear. 0 frequency term i = 1.5.exp(-j*n*pi))/(j*2*pi*n).'. w(i) = n*wo. % plot truncated FS representation of f(t) plot(t. titlevec = ['Truncated f(t) FS for n = ' num2str(N(i)). *** clear. % vector index to help store Dn and w for n = -4:-1.2 Prosedur : 1. end. sisi kiri) atau menggunakan sembarang text editor. % and actual signal hold on.. clf. %Compute&store fouriercoef.01:4. % fundamental period and frequency D0 = 0. % compute truncated FS for above N values f = D0*ones(size(t)). %Compute&store Fourier coef. i = i + 1.i).

ylabel('|D_n|'). xlabel('\omega '). % add FS terms end. % add FS terms end.2.values at which we'll truncate FS for i = 1:4. % open and clear figure 1 To = 1. wordpad dll. % loop over negative n Dn = j/(2*pi*n).. % Fourier coefficient f = f + real(Dn*exp(j*n*wo*t)).'filled'). subplot(2. Ubah parameter n lebih besar dan lebih kecil. % increment vector index. end. for n = 1:N(i). % Fourier coefficient f = f + real(Dn*exp(j*n*wo*t)). subplot(2. xlabel('\omega ').[-1 0 -1 0 -1 0]. .. % plot phase spectrum of f(t) stem(w. Ketik command line dibawah ini % *** Plot truncatated FS for various numbers of terms. clf. xlabel('t '). Mengapa perlu off-set ? 6.3 Prosedur : 1. Apa yang anda peroleh ? Percobaan 3. title('Phase Spectrum of f(t) Showing First Four Harmonics').1. wo = 2*pi/To. % compute truncated FS for above N values f = D0*ones(size(t)). % time over which we'll plot signal N = [1 5 10 50].i).abs(Dn).i = i + 1. % plot truncated FS representation of f(t) plot(t. end..1. % plot magnitude spectrum of f(t) stem(w. Double-click Matlab/scilab 2. titlevec = ['Truncated f(t) FS for n = ' num2str(N(i)). ylabel('f(t)'). % +/. title('Magnitude Spectrum of f(t) Showing First Four Harmonics').angle(Dn). % fundamental period and frequency D0 = -0. 3.'filled'). *** clear.1).'. % start out with DC bias term for n = -N(i):-1. % loop over positive n Dn = j/(2*pi*n). % clear matlab's memory figure(1). seperti notepad.01:2.f). plot([-1 0 0 1 1 2].'. hold off. Buka text editor matlab (icon persegi putih. sisi kiri) atau menggunakan sembarang text editor.':').num2str(N(i))]. % signal offset t = -1:0. Apa yang anda amati ? 5. subplot(2.2). title(titlevec).5. % and actual signal hold on. ylabel('\angle D_n '). 4.

4. for n = -4:-1. xlabel('\omega '). Suyanto. % clear matlab's memory figure(2). Dn(i) = j/(2*pi*n). i = 1. Apa perubahan yang terjadi pada magnitude spectrum dan fase spectrum ? Laporan Praktikum disusun dengan menjawab semua pertanyaan setelah langkah ke-3 prosedur praktikum.'filled'). i = i + 1. MT 4. subplot(2. clf. % store associated frequency % increment vector index. Sertakan semua plot dan modifikasi source code yang anda buat. % plot magnitude spectrum of f(t) stem(w.1. wo = 2*pi/To. % open and clear figure 2 To = 1.Sc 2.% *** Plot exponential magnitude and phase spectra for 1st 4 harmonics clear. M. Dr.5. Semakin kreatif mengubah source code dan membahas dalam laporan. Dn(i) = D0. Apriani Kusumawardhani. MT 3. for n = 1:4. D0 = -0.1. w(i) = n*wo. end. i = i + 1. xlabel('\omega '). % plot phase spectrum of f(t) stem(w.abs(Dn). anda akan mendapat nilai ekstra. title('Phase Spectrum of f(t) Showing First Four Harmonics').3 pada magnitude spectrum dan fase dari spectrum ? 6. Silakan rubah periode dasar (fundamental period) dengan berbagai angka (minimal empat buah periode yang berbeda). Dhany Arifianto . title('Magnitude Spectrum of f(t) Showing First Four Harmonics'). w(i) = 0.angle(Dn). Apa bedanya dengan percobaan 2. Jangan terlambat mengumpulkan ! Mencontek/menjiplak akan diberi nilai E ! Have fun ! Instruktur praktikum : 1. 0 frequency term vector index to help store Dn and w loop over negative n Compute & store fourier coef.2).2 ? 5. ylabel('\angle D_n '). Katherin Indriawati. end. ylabel('|D_n|'). store associated frequency increment vector index % store 0 frequency terms % increment vector index % loop over positive n % Compute & store Fourier coef.1).2 dan percobaan 2.'filled'). % % % % % % % fundamental period and frequency signal offset. Eng. Apa perbedaan antara percobaan 2. w(i) = n*wo. subplot(2. i = i + 1. Dn(i) = j/(2*pi*n).