How i find period and frequency of signal

36 visualizaciones (últimos 30 días)
Yossi Benyakar
Yossi Benyakar el 21 de Abr. de 2016
Respondida: Baltam el 21 de Abr. de 2016
Hi How i find period and frequency of signal
t=-2*pi:0.01:2*pi;
k1=3;k2=1;k3=1;k4=3;k5=7;k6=8;
y=k1*cos(((2*pi)/k2)*t+k3)+k4*cos(((2*pi)/k5)*t+k6);
How i find period?

Respuesta aceptada

Baltam
Baltam el 21 de Abr. de 2016
Use fourier transform
t=0:0.01:70-0.01; % I chose the maximum time to be a multiple of 7.
% You need to try and fit an exact amount of periods into your signal to
% get good results with fft or otherwise use a very long signal
k1=3;k2=1;k3=1;k4=3;k5=7;k6=8;
y=k1*cos(((2*pi)/k2)*t+k3)+k4*cos(((2*pi)/k5)*t+k6);
% Your periods are going to be k2 and k5
% Sampling frequency
Fs = 1/(t(2)-t(1));
% Calculate fft
ydft = fft(y);
% Only take one side of the Fourier transform
ydft = 2*ydft(1:ceil((length(y)+1)/2));
% Calculate the frequencies
freq = 0:Fs/length(y):Fs/2;
% Normalise according to length of signal
ydft = ydft/(2*length(freq));
figure,
subplot(3,1,1), plot(t,y), xlabel('Time [s]')
subplot(3,1,2), loglog(1./freq,abs(ydft)), xlabel('period [s]')
subplot(3,1,3), loglog(freq,abs(ydft)), xlabel('frequency [Hz]')

Más respuestas (0)

Categorías

Más información sobre Signal Processing Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by