how can i get mean frequency in special rang?

2 visualizzazioni (ultimi 30 giorni)
NGR MNFD
NGR MNFD il 2 Mag 2022
Risposto: Jonas il 2 Mag 2022
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

Risposte (1)

Jonas
Jonas il 2 Mag 2022
use
mean(M2(f>0.002 & f<0.55))

Categorie

Scopri di più su Fourier Analysis and Filtering in Help Center e File Exchange

Prodotti


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by