How i find period and frequency of signal
조회 수: 37 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Signal Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!