0% found this document useful (0 votes)
91 views6 pages

(Final Task) Mag I After Uts

The document discusses several signal processing tasks including creating a band pass filter impulse response, generating a wavelet by summing sinusoidal signals of varying frequencies, and synthesizing a Ricker wavelet for storage on a hard disk. It provides code examples for performing a finite impulse response filtering, taking the Fourier transform of signals, and implementing a subroutine to generate the Ricker wavelet values.

Uploaded by

Nurul Nur Annisa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views6 pages

(Final Task) Mag I After Uts

The document discusses several signal processing tasks including creating a band pass filter impulse response, generating a wavelet by summing sinusoidal signals of varying frequencies, and synthesizing a Ricker wavelet for storage on a hard disk. It provides code examples for performing a finite impulse response filtering, taking the Fourier transform of signals, and implementing a subroutine to generate the Ricker wavelet values.

Uploaded by

Nurul Nur Annisa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

TUGAS MAG SETELAH UTS

1. FIR (FINITE IMPULSE RESPONSE)


% Tugas MAG I % LANGKAH 3 : MISAL KITA BUAT ADA
% Author : Nurul Nur Annisa DATA --> Datanya dijumlahkan
12/331379/PA/14637 (INGAT!LPF 7 Hz dan HPF 70 Hz
% ----------------- % JADI NANTI FREKUENSI YG KELUAR
% BAND PASS FILTER ANTARA 7 - 70 HZ)
% ----------------- k = 2000;
fl = 5; f2 = 10; f3 = 50 ; f4 =80;
%LANGKAH 1 : MEMBUAT TANGGAPAN a1 = 5; a2 =2.5;a3 = 0.5;a4 =0.25;
IMPULSE
dt = 0.001; for i=1:k;
fl = 7; % Low Pass Frequency x(i) = a1*sin(2*pi*fl*(i-
fh = 70; % High Pass Frequency 1)*dt)+a2*sin(2*pi*f2*(i-
fs = 1/dt; % Cut off Frequency 1)*dt)+a3*sin(2*pi*f3*(i-1)*dt);

wl = 2*pi*fl; x(i)=x(i)+a4*sin(2*pi*f4*(i-
wh = 2*pi*fh 1)*dt);
fN = 1/(2*dt); %Nyquist Freq. end;
wN = 2*pi*fN; figure;
wo = (wh-wl)/wN;%Pada saat n=0 plot(x);
h = 2*(wh-wl)/wN; title ('DATA F SEBELUM
n = 128; DITRANSFORMASI FOURIER')

%ONE SIDED IMPULSE RESPONSE %LANGKAH 4: KITA MAU MENGHILANGKAN


for i = 2:n; DATA F YANG ADA DI LUAR FREKUENSI
h(i) = (2*(wh-wl)/wN)*(sin((i- CUTOFF DENGAN CARA MELEWATKANNYA
1)*pi*(wh-wl)/wN))/((i-1)*pi*(wh- PADA BPF
wl)/wN); m =1024;
X =fft(x,m);
end; f =fs/m*(0:127);
PH =X.*conj(X)/m;
XX =abs(X); mx=max(HH);
%TWO SIDED IMPULSE RESPONSE DB =20*log(XX/mx);
for i = 1:n; figure;
hp(i) = h(n-i+1); hold on;
hp(n+i) = h(i); grid on;
plot(f(1:100),DB(1:100));
end; title ('DATA F SETELAH
figure; DITRANSFORMASI FOURIER')
plot(hp);
title ('TANGGAPAN IMPULSE') %LANGKAH 5: FREQ DILEWATKAN DI BPF
y = conv(x,hp);
%LANGKAH 2 : TANGGAPAN ILMPULSE -- figure;
-> TRANSFORMASI FOURIER = TRANSFER plot(y);
% FUNCTION (TANGGAPAN FREKUENSI) title ('KONVOLUSI FREKUENSI
m = length(hp); FILTERING VS TANGGAPAN IMPULSE')
H = fft(hp,m); %Transf Fourier
f = fs/m*(0:127); %LANGKAH 6: DATA FREQ FILTERING
PH = H.*conj(H)/m; BPF * TANGGAPAN IMPULSE = FIR
HH = abs(H); mx=max(HH); for i=1:k;
DB = 20*log(HH/mx); x(i)=a1*sin(2*pi*fl*(i-
figure; 1)*dt)+a2*sin(2*pi*f2*(i-1)*dt);
hold on; end;
grid on; figure;
plot(f(1:25),DB(1:25)); plot(x)
title ('TRANSFER FUNCTION') title ('FIR (FINITE IMPULSE
RESPONSE)')
2. TANGGAP IMPULSE BAND PASS FILTER

%NAMA: NURUL NUR ANNISA


%NIM : 12/331379/PA/14637
%TUGAS MAG 1 : TANGGAP IMPULS BAND PASS FILTER
dt = 0.001;
fl = 10; % Low Pass Frequency
fh = 50; % High Pass Frequency
fN = 1/(2*dt); % Nyquist Freq.
wl = 2*pi*fl;
wh = 2*pi*fh;
wN = 2*pi*fN;
n= 128;

%ONE SIDED IMPULSE RESPONSE BPF


for i = 1:n;
j(i) = ((2*(i-1)*pi)^-1)*((sin((i-1)*pi*wh/wN))-(sin((i-1)*pi*wl/wN)));
end;

figure;
plot (j);
title ('TANGGAP IMPULSE BPF 1 SISI')

%TWO SIDED IMPULSE RESPONSE BPF


for i = 1:n;
hp(i) = j(n-i+1);
hp(n+i) = j(i);

end;

figure;
plot(hp);
title ('TANGGAP IMPULSE BAND PASS FILTER')
3. WAVELET DARI JUMLAHAN SINUS

%PROGRAM WAVELET DARI PENJUMLAHAN %Menggambar dan Menjumlahkan


SINUS DENGAN VARIASI FREKUENSI Sinus-sinus yang ada di ph
%PRAKTIKUM MAG I for i = 1:25
%********************************* for j = 1:n
****************************** y(j) = ph(j,i); %jumlahan
sinus untuk satu frekuensi
n = 2500; z(j) = z(j)+y(j); %Hasil
dt = 0.002; penjumlahan Sinus
a = 1.0 ; f = 1.0, phs = 0.0; end;

% Membuat kumpulan sinus hold on;


dimasukkan ke matriks ph axis ij;
for i = 1 : 25 %matriks kolom plot(y(1:n)+dx,tt(1:n),'Red',
for j = 1:n %matriks baris 'Linewidth',1); %Warna merah tebal
ph (j,i) = 1
a*sin((2*pi*f*(j-1)*dt)+phs); title ('Gelombang Sinus')
end; dx = dx+0.5;
phs = phs+0.0; % ini fase nya end;
masih 0, belum berubah
f = f+1;%nanti f nya berubah subplot(1,2,2);
end; hold on;
figure; axis ij;
plot
dx = 0.0; (z(1:n),tt(1:n),'Red','Linewidth',
tt = 0:dt:5.0; 1);
subplot (1,2,1);
for i = 1:n;
z(i) = 0.0; title ('Wavelet Dari Jumlahan
end; Sinus')
4. RICKER WAVELET SINTETIK (SUBROUTINE)
C NAME: RICKER WAVELET SINTETIK
C ============================= C MEREKAM KE HARDDISK & FORMAT
C AUTHOR: NURUL NUR ANNISA DO 20 I = 1,N
C MEMBUAT RICKER WAVELET DAN WRITE(2,100)(RK(I,J),J= 1,M)
MENYIMPAN PADA HARDDISK 20 CONTINUE
C 02/01/15 09:43
PROGRAM RICKER_WAVELET C FORMAT PENULISAN
DIMENSION R(100),RK(100,50) 100 FORMAT(10F12.2)
CHARACTER (LEN=50)::NMFL STOP
NMFL ='D:/RICKER10.TXT' END
OPEN(UNIT=2,FILE=NMFL)
C MEMBUAT SUBPROGRAM
C MEMASUKKAN PARAMETER YANG SUBROUTINE RICKER(F,N,DT,R)
DIKETAHUI DIMENSION RICK(100),R(100)
N = 55 PHI = 3.14
M = 10 N1 = (N+1)/2
F = 20 DO 10 I = 1,N1
DT= 0.002 B = (PHI*F*(I-1)*DT)**2
RICK(I) = (1-2*B)*EXP(-B)
C MELAKUKAN PERULANGAN 10 RICKER 10 CONTINUE
DO 10 I = 1,M DO 30 I = 1,N1
CALL RICKER(F,N,DT,R) R(N1+I) = RICK(I)
DO 11 J = 1,N R(I) = RICK(N1-I+1)
RK(J,I) = R(J) 30 CONTINUE
11 CONTINUE RETURN
F = F+1 END
10 CONTINUE
5.

You might also like