Median Frequency
古いコメントを表示
I am trying to use Matlab to find the median frequency of an EMG signal. The code I am using is below, and s is my signal. X is the frequency value I am trying to find so Z=P. Is there any solve function I can use to quickly find this answer or is guess and check my best bet? Or does anyone know an easieer method to find the median freq.?
>> Fs = 10000;
>> nfft = 2*nextpow2 (length(s));
>> Pxx = abs(fft(s,nfft)).^2/length(s)/Fs;
>> Hpsd = dspdata.psd(Pxx(1:length(Pxx)/2),'Fs',Fs);
>> plot(Hpsd);
>> P = avgpower(Hpsd)/2
>> Z = avgpower(Hpsd,[0,X])
Thanks
採用された回答
その他の回答 (2 件)
Wayne King
2011 年 8 月 23 日
0 投票
I suspect your problem is that your signal has a nonzero mean possibly as a result of some nonstationarity or simply due to a DC shift. This would cause the OverHalfIdx variable in Honglei's code to be 1 and UnderHalfIdx to be empty.
I suggest you detrend your signal first. If you signal exhibits simply a DC shift, this can be accomplished with:
s = detrend(s,0);
If the nonzero mean is due to nonstationarity, it is trickier to handle.
Honglei's suggestion is a great solution after that.
mohamed ashour taha
2015 年 12 月 21 日
0 投票
how can i use it in for loop % Hpsd = psd(h,S2,'Fs',Fs,'NFFT',NFFT);
カテゴリ
ヘルプ センター および File Exchange で Spectral Measurements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!