How can I plot some fft data in a different way?
Show older comments
Dear all,
I usual plot spectrograms plotting time vs. frequency vs. amplitude. I have collected some records through a microphone and each of the recordings are named usign a parameter, so called 'ϕ'. I would like to plot a single spectrogram similar to the one in the attached picture containing my data. File structure is 2 colums (time and amplitude) and 10000 rows.
Could you please help me making this "ϕ vs. frequency vs. amplitude" plot by using the two signal files attached?
I would sincerly appreciate it since I am litterally freaking out trying to fixing this issue.
4 Comments
Yazan
on 21 Jul 2021
Define for us first the relation between time and ϕ. As you said, the spectrogram helps you plot the instantaneous spectra. To plot the instantaneous spectra as a function of ϕ, you need to define the relation between ϕ and time.
Francesco Pignatelli
on 22 Jul 2021
Francesco Pignatelli
on 22 Jul 2021
Edited: Francesco Pignatelli
on 22 Jul 2021
Accepted Answer
More Answers (1)
% Assume there are 3 spec (corresponding to phi)
nf = 20; nt=15; nspec = 3;
sp = randn(nf, nt, nspec);
% reshape the spectrogram to 2D
sp = reshape(sp, [nf, nt*nspec]);
% multiple spectrograms
imagesc(sp);
% annotation
h = gca;
h.XTick = 0.5+(0:nspec-1)*nt;
h.YTick = [];
grid on
phi = [1.2 3.4 5.6];
h.XTickLabel = string(phi);
xlabel('\phi')
1 Comment
Francesco Pignatelli
on 22 Jul 2021
Categories
Find more on Scopes and Data Logging in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


