I have 2 and a half minutes of EMG data that I need to conduct a short time fourier transform on and then average within the short 250 ms epochs. Then that data needs to be combined into 20 second intervals. I used the buffer funtion to separate the data into 250 ms intervals but I cannot figure out a way to take the average of each coloumn without manually inputing it. Is there a way to do it all at once as there are 24000 columns. And also how would I be able to combine the averaged data into 20sec intervals, I tried the buffer function but that didn't work. My code can be seen below.
Fs = 2048; % Sampling Frequency
segment = 0.25; % Segments (250 msec)
Samples_fft = round (Fs * segment); % Sample Length
L_UTR_int_fft = buffer(L_UTR_Detr, Samples_fft); %this will create columns that contain 20 sec of data
% 4) Complete the Fast Fourier Transform
Fs= 2048; % Sampling Frequency
L= length(L_UTR_Cond); % Signal Length
t= mean(diff((L_UTR_Cond)); %Sampling Time
Fn= Fs/2 % Nyquist Frequency
L_UTR_fft= fft(L_UTR_int_fft) P2=abs(L_UTR_fft /L);P1=P2(1:L/2+1);P1(2:end-1) = 2*P1(2:end-1); L_UTR_fft_final = fs*(0:(L1/2))/L1; % I saw this online, and I think it needs to be done
Best Answer