I want to find the first period $T_0$ in a signal $x[n]$ and save it to a vector $\hat x$? $x[n]$ is read in by the command:

[x, fs] = audioread('Data/sample1.wav');

First of all, I have calculated the main frequency of the signal x[n]. I did it by

[x, fs] = audioread('Data/sample1.wav');
N = length(x);
f = (0:(N-1))*fs/N;
xdft = fft(x);
[~,index] = max(abs(xdft(1:length(x)/2+1)));
freq = 0:(fs/length(x)):fs/2;

Ok. freq is now my main frequency. As a next step, I want to calculate T_0.

T_0 = 1/fs;

And now I have to find this sequence, but how to do this? If I guess the signal in the wave is sines or cosines, but I do not know how to check this.

  • 1
    $\begingroup$ shouldn't be T_0as T_0 = 1/freq $\endgroup$
    – Zeeshan
    May 22, 2017 at 13:17
  • $\begingroup$ @Zeeshan if you write an answer. I can mark it as solved. $\endgroup$
    – j35t3r
    Aug 30, 2017 at 19:15

1 Answer 1


The time period should be inverse of the signal's frequency

T_0 = 1/freq

not sampling frequency


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.