data = load('k.txt');

Fs = 250;  % Sampling frequency
T = 1/Fs;  % Sample time
L = 500;  % Length of signal
t = (0:L-1)*T; % Time vector
 
x = data(:,1);
y = x;
plot(Fs*t,y)
title('Signal Corrupted with Zero-Mean Random Noise')
xlabel('time (milliseconds)')

NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(y,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);

% Plot single-sided amplitude spectrum.
plot(f,2*abs(Y(1:NFFT/2+1)))
title('Single-Sided Amplitude Spectrum of y(t)')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')




이렇게 짜긴했는데 뭔가 이상하게 나오거든


코드가 잘못된건가? 맞는거같은데도 이상하게 나오네