Error when using "pspectrum" with "spectrogram" option.

2 ビュー (過去 30 日間)
Ana Caramete
Ana Caramete 2020 年 4 月 28 日
コメント済み: Ana Caramete 2020 年 4 月 28 日
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')
---------------------------------------------------------------------------------------------------------------

採用された回答

Deepak Gupta
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.
  1 件のコメント
Ana Caramete
Ana Caramete 2020 年 4 月 28 日
Hello,
Thank you very much! Normalising solved the problem indeed.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTitle についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by