Clear Filters
Clear Filters

combine spectrogram result in one figure

6 views (last 30 days)
nirwana
nirwana on 1 Jun 2024
Edited: nirwana on 1 Jun 2024
I have 20 min signal and would like to combine its sepectogram become one spectrogram consecutively. my idea is put index of each S, P, T value and then joining together in one array then using imagesc. But I don't know if this flow is effective, since I have to combine for each 20 minutes into a month.
I write part of coding but I don't know how to looping index for spectogram result.
Please help me.
%% SPECTROGRAM
clc, close all, clear all
set(0,'DefaultFigureWindowStyle','docked')
datafold = uigetdir(pwd,'Select data Folder');
myfiles=dir([datafold '/*.DAT']);
N = length(myfiles) ; % total number of files
data = cell(N,1)
for i = 1:N
thisfile = myfiles(i).name ;
y = importdata(thisfile);
t=(0:length(y)-1)';
Nspec=512;
wspec=hamming(Nspec);
Noverlap=Nspec/2;
fs=100;
[Si,Fi,Ti,P]=spectrogram(y,wspec,Noverlap,Nspec,fs,'xaxis');
% nexttile
% imagesc(T/60,F,10*log10(P));
% axis xy;
% axesHandle.YLim = [0.1 10000];
% colormap default;
% cbar = colorbar;
% cbar.Label.String = {'Intensity in dB'};
% xlabel('Time (s)');
% ylabel('Freqwency(Hz)');
% title('Spectrogram with RemInsRes');
end

Answers (0)

Community Treasure Hunt

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

Start Hunting!