MATLAB Answers

How can I find Period of Signal

293 views (last 30 days)
Baris Ersoy
Baris Ersoy on 18 Oct 2018
Answered: madhan ravi on 18 Oct 2018
I have a signal which is X in code. I want to find this period. The ans is 0.0049 but I am not sure it is true. Is it the correct way to find period?
%%Time specifications:
Fs = 8000; % samples per second
dt = 1/Fs; % seconds per sample
StopTime = 0.25; % seconds
t = (0:dt:StopTime); % seconds
%%Sine wave:
Fc1 = 50; % hertz
Fc2 = 200;
Fc3 = 400;
Fc4 = 600;
x1 = sin(2*pi*Fc1*t+pi);
x2 = 0.5*cos(2*pi*Fc2*t + (pi/2));
x3 = (1/3)*sin(2*pi*Fc3*t + (pi/3));
x4 = 0.25*cos(2*pi*Fc4*t + (pi/4));
X = x1+x2+x3+x4;
ac=xcorr(X,X);
[~,locs]=findpeaks(ac);
mean(diff(locs)*dt)

  0 Comments

Sign in to comment.

Sign in to answer this question.