clear all
close all
clc

[s,fvz] = wavread('trqbron-NZ.wav' );
s = s';
% plot( x );

delka = length( s );

N = 2*256; % delka signalu v jednom useku, volime

M = round( delka/N );  %pocet useku;


%vypocet vykonovpho spektra metodou periodogramu
f2 = zeros (1,N);
for i=1:M-1,
    ind1 = (i-1)*N+1;
    ind2 = i*N;
    pom = s(ind1:ind2);
    
    f = abs( fft(pom) ).^2;

    f2 = f2+ (f/N);
end
f2 = f2/M;


frekvence = linspace (0,fvz/10,N/2);
stem ( frekvence, f2(1:N/2),'r');
title ('')
xlabel ('frekvence [Hz]');
ylabel ('amplituda [-]')
