Get STFT plot with matrix Input

Hello,
I am working with a radar output Q/ I matrix and I want to apply stft on the complex matrix (I + j Q) using matlab.
The stft function didn't accept Matrix Input. Is there a way to do it ?
Thank you so much in advance :)

답변 (2개)

nur dsc
nur dsc 2021년 4월 6일
편집: nur dsc 2021년 4월 6일

1 개 추천

Hi Nour,
You do not need a matrix format actually. I+j*Q is also in vector format and you can apply stft this complex data.
If you have orijinal x signal you can use hilbert(x).
result = hilbert(x)
then you can apply stft to result.
Priyanshu Mishra
Priyanshu Mishra 2019년 9월 19일

0 개 추천

Hi Nour,
In the documentation page of stft, under the input argument section, it is mentioned that x can take vector and matrix both. You may refer to examples given in the documentation page of stft.

댓글 수: 4

Nour
Nour 2019년 9월 19일
Thank you for you answer :) But when I apply stft function to that matrix I got this error. Do you have any idea how to fix this ?
image (1).png
Priyanshu Mishra
Priyanshu Mishra 2019년 9월 20일
So the documentation I shared with you are for MATLAB2019b. It is released now. The stft and istft functions now accept multichannel signals as input. You can download MATLAB2019b.
Nour
Nour 2019년 9월 20일
Perfect I used this version and it works, but it does not plot the result. Do you have any idea how to get the plot? Thank you so much in advance :)
The stft function in 2019b only supports plotting of vector inputs. If you want to use the convenience plot of stft for your matrix input, you could do so within a for loop. Alternatively, you could specify your own plots using pcolor and subplot like in the following example:
fs = 1e3; % Sampling frequency (Hz)
t = 0:1/fs:1-1/fs; % Time (sec)
x = [chirp(t,100,1,300,'quadratic',45,'concave');
chirp(t,200,1,600,'quadratic',[],'convex');
chirp(t,300,1,500,'logarithmic')]'; % 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
colorbar
caxis(caxisLims)
title(sprintf('Channel %d',ii))
end

댓글을 달려면 로그인하십시오.

질문:

2019년 9월 16일

편집:

2021년 4월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by