Plot 3D matrix with complex values

I have a matrix of complex values (a i +b), with shape 128 * 8 * 121. How can I plot it, please ?
Thank you so much in advance :)

6 comentarios

darova
darova el 23 de Sept. de 2019
What those values represent?
nour besbes
nour besbes el 23 de Sept. de 2019
It represent the result of the stft matlab function
darova
darova el 23 de Sept. de 2019
Where those values should be on the graph?
nour besbes
nour besbes el 23 de Sept. de 2019
I want to have a graph like this one.
stft.png
darova
darova el 23 de Sept. de 2019
What do dimension mean? (128 x 8 x 121) ?
nour besbes
nour besbes el 23 de Sept. de 2019
it's a 3D matrix. It means 8 matrix of (128 rows X 121 columns ) size.

Iniciar sesión para comentar.

Respuestas (3)

Matt J
Matt J el 23 de Sept. de 2019
Editada: Matt J el 23 de Sept. de 2019
One way,
plot(a(:),b(:),'x')
darova
darova el 23 de Sept. de 2019
Try pcolor
pcolor(A(:,1,:)) % display first matrix
Sara James
Sara James el 21 de Oct. de 2019
As another mentioned previously, use pcolor. Note that since your signal is complex, you will have to take the absolute value first as follows:
fs = 3000; % Sampling frequency (Hz)
t = 0:1/fs:1-1/fs; % Time (sec)
x = [exp(2j*pi*100*cos(2*pi*2*t))+randn(size(t))/100; ...
exp(2j*pi*100*cos(0.5*pi*2*t))+randn(size(t))/100; ...
exp(2j*pi*100*cos(1*pi*2*t))+randn(size(t))/100]'; % Multi-channel signal
[S,F,T] = stft(x,fs,'Window',hamming(128,'periodic'),'OverlapLength',50);
smag = mag2db(abs(S)); % Convert to dB
caxisLims = max(smag(:)) + [-60 0]; % Color axis limits
figure('Name','STFT')
numChannels = size(x,2);
for ii = 1:numChannels
subplot(2,2,ii)
pcolor(T,F,smag(:,:,ii))
xlabel('Time (s)')
ylabel('Frequency (Hz)')
shading flat
hC = colorbar;
hC.Limits = caxisLims;
hC.Label.String = 'Magnitude (dB)';
title(sprintf('Channel %d',ii))
end
sgtitle('Spectrogram')

Categorías

Más información sobre Line Plots en Centro de ayuda y File Exchange.

Preguntada:

el 23 de Sept. de 2019

Respondida:

el 21 de Oct. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by