how can i get mean frequency in special rang?

1 次查看(过去 30 天)
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