How i find period and frequency of signal

21 ビュー (過去 30 日間)
Yossi Benyakar
Yossi Benyakar 2016 年 4 月 21 日
回答済み: Baltam 2016 年 4 月 21 日
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?

採用された回答

Baltam
Baltam 2016 年 4 月 21 日
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]')

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSignal Processing Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by