Time resolution of Spectral Entropy - How could I modify it?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello everyone,
I have a signal (a timetable of 307,200 data points) with sampling rate of 20480 Hz (0.00005s) and total length of 15.0 seconds.
When I apply the command pentropy I get a time vector te with length 500 points, equivalent to a time resolution of 0.03 seconds
I confirmed this value as shown below. The problem is that I need the spectral entropy of the signal every 0.02 seconds and every 0.05 seconds.
Is any way where I can adjust or define this "time resolution"?
[se,te] = pentropy(Datos01.Sensor1,Fs)
mean(diff(te))
ans =
0.02997
Could someone help me? Thanks
P.S. I was planning to use the retime command and @pentropy as input but it sends me an error. See Below
Other alternative would be using a for and a moving window but not sure how to code it
DatosA = retime(Datos01,"regular",@pentropy,"TimeStep",seconds(windowLength));
% Error using timetable/retime (line 140)
% Applying the function 'pentropy' to the 1st group in the variable 'Sensor01' generated the following error:
% Expected input argument 2 to be time information in the form of a numeric scalar as sampling frequency, a duration
% scalar as sampling time or a numeric/duration/datetime array as time values.
댓글 수: 0
채택된 답변
Yazan
2021년 8월 11일
편집: Yazan
2021년 10월 12일
You need to provide the spectrogram to the Matlab function, and this spectrogram should have your desired time resolution.
See the example below.
clc, clear
fs = 20480;
f = 0.01*fs;
ts = 1/fs;
t = 0:ts:15-ts;
x = cos(2*pi*f*t);
% compute power spectrogram with time resolution equal to 0.02 sec
% note that the overlap between the spectrogram windows is set to zero
% if you introduce overlap between the windows, the time resolution should
% be changed to guarantee that 'tp' is sampled every 0.02 sec
[p, fp, tp] = pspectrum(x, fs, 'TimeResolution', 0.02, 'OverlapPercent', 0, 'spectrogram');
% compute spectral entropy
[se, te] = pentropy(p, fp, tp);
fprintf('Spectral entropy estimated every %g sec\n', mean(diff(te)));
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spectral Estimation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!