Undefined function periodgram for input arguments of type double?

Hello!
I am trying to use the function periodgram in order to plot a timeseries (x) which was an 100x4 matrix.
Fs = 400
x = x(:,1)
[PSD, normalized_frequency] = periodgram(x,Fs)
I am getting the following error:
Error in periodogram (line 202)
if any([signal.internal.sigcheckfloattype(x1,'single','periodogram','X')...
Undefined function 'periodgram' for input arguments of type 'double'.
end
when I went to go look at the documentation, I got this message:
Input X in periodogram must be double/single, instead it was char.
Which seems to be giving mixed messages.
I tried the following:
%1) converting double to single
x = x(:,1);
x = single(x);
[PSD, norm_frequency] = periodgram(x, Fs)
Do you have any suggestions?
Thanks so much.

 Akzeptierte Antwort

Star Strider
Star Strider am 17 Jun. 2022

0 Stimmen

It would be nice to know what ‘x’ is.
If it is a table, the reference should be:
x{:,1}
(note the curly braces {}) instead.

6 Kommentare

nines
nines am 17 Jun. 2022
Bearbeitet: nines am 17 Jun. 2022
hello!
here is a picture of x. It is a table I believe!
I used brackets instead but am now getting an error that the brackets are not supported with variables of this type.
x = x{:,1};
[PSD, norm_frequency] = periodgram(x, Fs)
Thanks for all of your help!
My pleasure!
Assign it to something with a different name:
xv = x{:,1};
[PSD, norm_frequency] = periodgram(xv, Fs)
The error probably refers to the problem of having ‘x’ on both sides of the assignment.
.
nines
nines am 17 Jun. 2022
Bearbeitet: nines am 17 Jun. 2022
hmm unfortunately I just checked and changed the variables and am still getting the same error that brace indexing is not supported for variables of this type.
physio_timeseries = phys{:,1};
[PSD, norm_frequency] = periodgram(physio_timeseries, Fs)
thanks so much!
As always, my pleasure!
I would have to know what type variable it is, and preferably have it to experiment with.
I would just like to send along a huge thank you -- honestly, my thesis would be not nearly where it is without your help and all of the nice senior people at matlab answers. I was reading a lot of your answers on matlab and am just so impressed and so grateful at all of your time and dedication to this; thanks a ton. :)
As always, my (our) pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by