How can I find Period of Signal
87 views (last 30 days)
Show older comments
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
Answers (1)
See Also
Categories
Find more on Subspace Methods in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!