# I want to find the first period $T_0$ in a signal $x[n]$ and save it to a vector?

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.

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