ps

2
Nama : Iwan Budihartana NPM : 140310130015 TUGAS PENGOLAHAN SINYAL t = 0:0.01:2; A = 5; f = 2; xt = A*sin(2*pi*f*t); subplot(2,2,1); plot(t,xt,'LineWidth',2); axis([0 4*(1/f) -A A]) xlabel('t(detik)'); ylabel('x(t)'); box('off'); grid('on'); n = 0:100; fs = 20; %20hz Ts = 1/fs; nTs = n*Ts; xn = A*sin(2*pi*f*nTs); subplot(2,2,2); h3 = stem(n,xn,'.r','LineWidth',2); axis([0 4*fs/f -A A]) xlabel('n(sample ke n), Ts=1/20detik'); ylabel('x(n)'); box('off'); grid('on'); S=fft(xn,512); % spektrum frekuensi w=(0:255)/256*(fs/2); subplot(2,2,3) plot(w,abs(S(1:256))) title('3. Spektrum Frekuensi (FFT)') xlabel('Frekuensi (Hz)') ylabel('Amplitudo')

description

pengolahan sinyal

Transcript of ps

Page 1: ps

Nama : Iwan Budihartana

NPM : 140310130015

TUGAS PENGOLAHAN SINYAL

t = 0:0.01:2;A = 5;f = 2;xt = A*sin(2*pi*f*t);subplot(2,2,1);plot(t,xt,'LineWidth',2);axis([0 4*(1/f) -A A])xlabel('t(detik)');ylabel('x(t)');box('off');grid('on'); n = 0:100;fs = 20; %20hzTs = 1/fs;nTs = n*Ts;xn = A*sin(2*pi*f*nTs);subplot(2,2,2);h3 = stem(n,xn,'.r','LineWidth',2);axis([0 4*fs/f -A A])xlabel('n(sample ke n), Ts=1/20detik');ylabel('x(n)');box('off');grid('on'); S=fft(xn,512); % spektrum frekuensiw=(0:255)/256*(fs/2);subplot(2,2,3)plot(w,abs(S(1:256)))title('3. Spektrum Frekuensi (FFT)')xlabel('Frekuensi (Hz)')ylabel('Amplitudo') nT=0:1/fs:1;n=0:length(nT)-1;r=sin(2*pi*f*nT);U=abs(fft(r));frek=(0:length(U)-1)/length(U).*fs; %untuk menentukan sumbu x nya%figure;subplot(2,2,4);stem(frek,U);xlabel('Frekuensi');ylabel('|X(F/Fs)|');title('Spektrum frekuansi sinyal diskrit');

Page 2: ps