You are on page 1of 2

LAMPIRAN C

LISTING CODE
close all
clear
clc
data = xlsread('dataVRU.xlsx',6);
y = data(:,2);
t = data(:,1);
fs = round(length(y)/max(t));
tnew = min(t):1/fs:max(t);
ynew = interp1(t,y,tnew);
figure
plot(tnew,ynew);
xlabel('Waktu (s)');
ylabel('Kecepatan (in/s)');
grid on
N = length(ynew);
nfft = 2^nextpow2(N);
Y = fft(ynew,nfft)/N;
f = fs/2*linspace(0,1,nfft/2+1);
figure
plot(f,2*abs(Y(1:nfft/2+1)))
datacursormode on
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')
grid on

Halaman ini sengaja dikosongkan

You might also like