フィルターのクリア

how to calculate fast Fourier transform with a 128-point window on these data with non-uniform sampling frequency

14 ビュー (過去 30 日間)
Hi everyone
I have provided you with my MATLAB code and data. These samples were recorded at a non-uniform sampling frequency, so I used the NUFFT command to convert the Fourier.
Now, if I want to use fast Fourier transform with a 128-point window on these data with non-uniform sampling frequency to calculate the power spectrum, and then divide the frequency range of all power spectra into eight equal parts and divide the area under the 8-channel curve. What calculator code should I use to calculate?THANKS SO MUCH
This is my code:
%% load Data
DATA3 = [];DATA4 = [];FFT3 =[];M7=[];
for j =1:13
data3 = load(strcat(strcat('als',num2str(j)),'.ts'));
DATA3 = [DATA3;data3];
t3 = data3(:,1); f3 = (length(data3)/300))*(0:(length(t3)-1))/length(t3);
fft3 = nufft(data3(:,2:13),t3,f3);FFT3 = [FFT3;fft3]; M6 = abs(fft3);M7 = [M7;M6];
end
FFT4=[];M9=[];
for j = 1:16
data4 = load(strcat(strcat('control',num2str(j)),'.ts'));
DATA4 = [DATA4;data4];
t4 = data4(:,1); f4 = (length(data4)/300))*(0:(length(t4)-1))/length(t4);
fft4 = nufft(data4(:,2:13),t4,f4);FFT4 = [FFT4;fft4]; M8 = abs(fft4);M9 =[M9;M8];
% f4 = (0.8167/2)*(0:(length(DATA4)-1))/length(DATA4);
end

採用された回答

Mathieu NOE
Mathieu NOE 2022 年 7 月 5 日
hello
see my suggestion below
the result is in Area
clc
clearvars
load('DATA3.mat');
t3 = data3(:,1);
%% uniform resampling of data on 128 samples
nfft = 128; % fft length
newt3 = linspace(min(t3),max(t3),nfft); % equally spaced time vector
dt = mean(diff(newt3)); % new time increment
Fs = 1/dt; % sampling frequency
newdata3_2_13 = interp1(t3,data3(:,2:13),newt3,'linear');
%% fft
fft_spectrum = abs(fft(newdata3_2_13))/nfft;
% one sidded fft spectrum % Select first half
if rem(nfft,2) % nfft odd
select = (1:(nfft+1)/2)';
else
select = (1:nfft/2+1)';
end
fft_spectrum = fft_spectrum(select,:);
freq_vector = (select - 1)*Fs/nfft;
figure,semilogy(freq_vector,fft_spectrum);
%% divide the frequency range of all power spectra into eight equal parts
freq_points = linspace(min(freq_vector),max(freq_vector),8+1); % equally spaced freq vector
for cj = 1:numel(freq_points)-1
start = freq_points(cj);
stop = freq_points(cj+1);
ind = find(freq_vector>=start & freq_vector<=stop);
Area(cj,:) = trapz(freq_vector(ind),fft_spectrum(ind,:)); % Area under curve :
% rows = 8 (as many as parts) , cols = 12 , as many as signals
end
  9 件のコメント
Mathieu NOE
Mathieu NOE 2022 年 7 月 19 日
hmmm
I am not really the expert here for the neural training - tried to figure out the issue by reading the doc for function train but it's quite outside my area of expertise - sorry !!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAI for Signals についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by