How can I ensure that the Magnitude changes within one segment when performing a Short Time Fourier Transform and observing the plot?

1 回表示 (過去 30 日間)
So I'm ideally looking for a spectrogram such as this:
In this spectrogram the frequency and power value of these frequencies changes with time. For instance, at 2 seconds directly you have a small power concentration of frequencies at -100 Hz, a medium amount at 0 Hz and a small amount at 150 Hz.
So I have some very basic code that has a bunch of sine waves at different time periods each with different frequencies:
fs = 1000;
t = 0:1/fs:2;
temp = vco(sin(2*pi*t),[0 5],fs);
temp1 = vco(sin(2*pi*t),[5 10] ,fs);
temp2 = vco(sin(2*pi*t), [10 20],fs);
temp3 = vco(sin(2*pi*t), [20 50],fs);
temp4 = vco(sin(2*pi*t), [50 80],fs);
temp5 = vco(sin(2*pi*t), [80 110],fs);
temp6 = vco(sin(2*pi*t), [110 140],fs);
temp7 = vco(sin(2*pi*t), [120 140],fs);
temp8 = vco(sin(2*pi*t), [120 130],fs);
temp9 = vco(sin(2*pi*t), [100 140],fs);
temp10 = vco(sin(2*pi*t), [60 100],fs);
x = [temp temp1 temp2 temp3 temp4 temp5 temp6 temp7 temp8 temp9 temp10];
segment_length = length(temp);
fftSize = winSize;
overlap = floor(winSize/2);
stft(x,fs)
However, the STFT of this looks like this:
Which means that apart from some spectral leakage, whatever frequency is at that period is the maximum magnitude. However, comparing this to the more complete spectrogram, I'd like it to have more varying magnitude levels. I'm not entirely sure how to do this as I've tried using a multi-channel signal but these channels all have to be plotted separately on MATLAB.

回答 (0 件)

カテゴリ

Help Center および File ExchangeTime-Frequency Analysis についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by