how can i get mean frequency in special rang?

조회 수: 1 (최근 30일)
NGR MNFD
NGR MNFD 2022년 5월 2일
답변: Jonas 2022년 5월 2일
I want to get mean ferequncy in rang f = (0.002 0.55) just this . from this code matlab but i get this eror(Array indices must be positive integers or logical values.)
I do not know how to perform my work to solve this problem
my code matlab is:
for i = 1:1
data1 = load(strcat(strcat('park',num2str(i)),'.ts'));
fft1 = fft(data1);
M2 = abs(fft1.^2./length(data1));
f = (0.8167/2)*(0:(length(data1)-1))/length(data1);
figure,hold on;plot(f,M2(:,13),'r','linewidth',1.5);xlim([0.002 0.55]);
% % extract freq feature
% N = mean(M2(0.002 0.55));
end

답변 (1개)

Jonas
Jonas 2022년 5월 2일
use
mean(M2(f>0.002 & f<0.55))

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by