MATLAB: Frequency-time of EMG

emg

I am trying to use Matlab to find the median frequency with respect to time of an EMG signal.
B = xlsread('C:/Users//Desktop/fatigue_20.xlsx');
Fe=800;
A = B(0.1e4:8.2e5, :);
N=length(A);
t=0:1/Fe:(N/Fe)-1/Fe;
psdest = psd(spectrum.periodogram,A_si,'Fs',800,'NFFT',N);
normcumsumpsd = cumsum(psdest.Data)./sum(psdest.Data);
Ind = find(normcumsumpsd <=0.5,1,'last');
Median frequency=psdest.Frequencies(Ind)
but now how can i build the relation between the median frequency and the time?

Best Answer

If you want to find the median frequency with respect to time, you'll have to use the short-time Fourier transform (or some other time-frequency analysis technique)
Using the periodogram, you lose all time information.
You can use spectrogram() to obtain a matrix of PSD estimates with some degree of time localization that depends on how long the window (segment) is. You can then compute the median of your segments.