Error using pwelch - Expected x to be finite.

47 views (last 30 days)
Hi everyone,
x=load('\\fs01.hpc.unipr.it\bonini01\WIRELESS_Wifi_Router_Impianti2021\Acquisizioni Deuteron\ProvaHyper_20220915_M1\LFP1.mat');
input=x.LFP1;
y=fft(x.LFP1);
M1_LFP1=rmmissing(input);
N=64;
window=hamming(N);
noverlap=N/2;
nfft=length(M1_LFP1);
new_fs=542.4;
time_1=(1:length(M1_LFP1))/new_fs;
[s,f,t]=spectrogram(M1_LFP1,window,noverlap,nfft,new_fs);
colormap('jet');
This is my code to compute the spectrogram but when I'm running it appears this error:
Error using pwelch - Expected x to be finite.
My x, namely M1_LFP1, is a vector 1358x1, what is the problem?

Accepted Answer

dpb
dpb on 24 Oct 2022
x=load('\\fs01.hpc.unipr.it\bonini01\WIRELESS_Wifi_Router_Impianti2021\Acquisizioni Deuteron\ProvaHyper_20220915_M1\LFP1.mat');
input=x.LFP1;
M1_LFP1=rmmissing(input);
sum(~isfinite(M1_LFP1))
will show you how many elements are NOT finite in your input data -- some clearly are.
isBad=~isfinite(M1_LFP1);
will return the actual locations in logical addressing vector that you can see whether are nan or inf; you can, of course, count/find each of those with the appropriate functions isnan, isinf

More Answers (0)

Categories

Find more on Time-Frequency Analysis in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!