how can i get mean frequency in special rang?

2 Ansichten (letzte 30 Tage)
NGR MNFD
NGR MNFD am 2 Mai 2022
Beantwortet: Jonas am 2 Mai 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

Antworten (1)

Jonas
Jonas am 2 Mai 2022
use
mean(M2(f>0.002 & f<0.55))

Kategorien

Mehr zu Fourier Analysis and Filtering finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by