plotting spectrogram for 3d matrix
25 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
MarKf
il 1 Dic 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.
Risposte (1)
Nicolas Douillet
il 4 Dic 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 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!