load signaali.txt
x = signaali;

figure(1); clf;
n = [1 : length(x)];
stem(n, x); grid on; 
title('Aikatason signaali'); 
xlabel('indeksinumero');

figure(2); clf;
xF   = fft(x);
mag  = abs(xF);                            % magdB = 20*log10(abs(xF));
w    = 2*pi*[0 : length(xF)-1]/length(xF);
plot(w, mag); grid on;                     % tai oikeammin stem(w,mag)
title('Taajuustason spektri'); 
xlabel('norm. kulmataajuus \omega (rad)');
axis([0 pi 0 1.1*max(mag)]);
