Oleh:
Indah Naomi Pakpahan (118120063)
Kelas Analisis Data Geofisika H
Dosen Pengampu:
MATLAB
#118120063_Indah Naomi Pakpahan
#Percobaan Permasalahan Melakukan FFT terhadap data Time Series
clc
clear
close all
fs=100;
T=1/fs;
L=1100;
time=(0:L-1)*T;
wave= sin(pi*time*1)+ cos(pi*time*10); %Fungsi gelombang
plot(X)
%Ploting-2
Y=fft(X);
P2=abs(Y/L);
P1=P2(1:L/2+1);
P1(2:end-1)=2*P1(2:end-1);
f = fs*(0:(L/2))/L;
subplot(3,1,2)
plot(f,P1)
title('Amplitudo single dengan masih disertain noise)')
xlabel('f (Hz)')
ylabel('Magnitude')
%Ploting-3
Y = fft(wave);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
subplot(3,1,3)
plot(f,P1)
title('Amplitudo single dengan wave yang sudah FFT')
xlabel('F(Hz)')
ylabel('Magnitude')
import numpy as np
fs = 100.0
L=1100
T=1/fs
time = np.linspace(0,L-1,int(10*fs),endpoint=False)
X = np.random.random_integers(0,5,1000)
sinyal=wave+X
print(sinyal)
plt.subplot(311)
plt.subplots_adjust(hspace=1)
plt.plot(time,sinyal)
plt.xlim(0,1200)
plt.ylim(-10,10)
plt.xlabel("time (second)")
fft_wave = np.fft.fft(sinyal)
fft_real=np.fft.fft(wave)
plt.subplot(312)
plt.xlim(-50,50)
plt.ylim(-600,600)
plt.legend(loc=1)
plt.subplot(313)
plt.xlim(-50,50)
plt.ylim(-600,600)
plt.xlabel("frequency (Hz)")
plt.show()