How to get an image of a time frequency representation?

4 次查看(过去 30 天)
Hi, I am trying to compute a time frequency representation plot for a frequency range of 1-60hz. My first issue is that the code below takes a very long time time to compute = 30.7 seconds. Would anyone have any tips to make this more efficient?
tfr=zeros(60,900); % preallocation
for foi=1:60 % frequencies of interest from 1:60
windowsize1=[7*foi]; % 7 cycles foi=window of measurement
tfr(foi, :) = get_amplitude(data,fs,windowsize,foi); % function created to retrieve matrix of amps within this window
end
I then tried to plot this using the image function but get a fully purple plot. But if I just plot the scaling line I get some yellow activity at the lower end of the scale but no details of the data ( I've attached the image of the scaling line plotted). The image I get after plotting tfr eliminates all of the yellow to blue shading.
(p.s. the scaling line was a given so I know that's not the problem).
I have no clue what to change. Am I using some function incorrectly?
figure
image(32+32*tfr./max(max(abs(tfr)))); % scale the tfr
image(tfr)

回答(1 个)

Abhishek Ballaney
Abhishek Ballaney 2018-3-23
https://www.mathworks.com/help/signal/ref/spectrogram.html

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by