Error when using "pspectrum" with "spectrogram" option.
5 次查看(过去 30 天)
显示 更早的评论
Hello,
I am trying to plot the pspectrum of a signal, using the following command: pspectrum(SmallY,fs,'spectrogram') and I get the error listed below. SmallY is a 1x100,000 double array (here attached). What puzzles me most is that the same command works for another array, which is a 1x 9000 double (attached here as normal.mat).
Could someone please help with this? I don't see what is the difference between the two arrays, why is one working and the other not. Below, I am also listing the "code", although it's not much. Of course, the same code goes for 'normal' array.
load SmallY
fs=100000;
pspectrum(SmallY,fs,'spectrogram')
-----------------------------------------------------------------------------------------
Error using matlab.graphics.axis.Axes/set
Error setting property 'CLim' of class 'Axes':
Value must be a 1x2 vector of numeric type in which the second element is larger than the
first and may be Inf
Error in signalwavelet.internal.convenienceplot.plotTFR (line 178)
set(ancestor(hndl,'axes'),'CLim',[Pmax plotOpts.threshold]);
Error in pspectrum>displaySpectrogram (line 1078)
signalwavelet.internal.convenienceplot.plotTFR(t,f,10*log10(abs(P)+eps),plotOpts);
Error in pspectrum>computeSpectrogram (line 451)
displaySpectrogram(T,F,P,opts.IsNormalizedFreq,opts.MinThreshold,FRES,TRES);
Error in pspectrum (line 251)
[P,F,TORPWR] = computeSpectrogram(opts, nargout==0);
Error in test_27apr (line 17)
pspectrum(SmallY,fs,'spectrogram')
---------------------------------------------------------------------------------------------------------------
0 个评论
采纳的回答
Deepak Gupta
2020-4-28
Hello Ana,
There is a different between data sets normal and SmallY.
In dataset SmallY, values are extremly small. i.e. max value = 3.0620e-16 and min value = -3.0620e-16. This is what causing the error and pspectrum is unable to support such small numbers.
You can normalise your data before pspectrum to avoid this error.
SmallY = SmallY/max(abs(SmallY));
fs=100000;
pspectrum(SmallY,fs,'spectrogram')
Hope this helps.
cheers.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time-Frequency Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!