plotting spectrogram for 3d matrix
19 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi
I want to make a spectrogram on a matrix and not on a vector
Is there such a possibility?
% this is work for Vector:
r = randi([-130,-50],1,100);
s = spectrogram(r);
spectrogram(r,'yaxis')
But ,i what plot this:
% this is NOT work for matrix:
r = randi([-130,-50],100,100);
s = spectrogram(r);
spectrogram(r,'yaxis')
Another question
Is the MATLAB function also correct for LOG [dBm]?
Because in the first example I in the fig positive values ,
tnx
2 commentaires
MarKf
le 1 Déc 2022
spectrogram returns the time-frequency spectrum of one signal timeseries, so would a matrix be considered a single signal (in which case spectrogram(r(:)) would work, but it's unlikely this is case), or is each row (or column) a signal from which you want to extract the spectrograms? In that case use a loop or something like fieldtrip. Or maybe you want a periodogram (no time dim).
Log works, the positive values in the result are to be expected by the conversion solution of a non-perfect signal.
Réponses (1)
Nicolas Douillet
le 4 Déc 2022
As Marco said, spectrogram takes a vector as input, not matrix. However depending on how your signals are stored in your data matrix you have, you have four different possibilities :
I.1 Case your signal had actually been reshaped in a matrix :
s = spectrogram(r(:))
I.2 Symetric matrix case; same as previous but you will transpose r matrix before :
r = r';
s = spectrogram(r(:))
II.1 Case your matrix actually contains several signals you want to compute the spectrogram and each signal corresponds to one row of the matrix; if you want the spectrogram of the ith row / signal then just write :
s = spectrogram(r(i,:)) % i is the matrix row index
(In a loop or in a cell array function)
II.2 Case each column of the matrix if a signal :
s = spectrogram(r(:,j)) % j is the matrix column index
(In a loop or in a cell array function)
Hope this help. Good work.
0 commentaires
Voir également
Catégories
En savoir plus sur Spectral Measurements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!