Hi Nirwana,
Based on my understanding, you want to combine the spectrogram results of multiple signal files into a single, continuous spectrogram plot by comprehensively looping through the spectrogram for individual files.
You can refer to the following steps along with the attached code snippets :
1. Initialize two empty arrays “combined_S” and “combined_T”, to store the concatenated spectrogram data and time indices from all files.
2. Loop through the files and calculate the spectrogram of the current file. Then concatenate the power spectral density to “combined_S” and time indices to “combined_T”.
[Si, Fi, Ti, Pi] = spectrogram(y, wspec, Noverlap, Nspec, fs, 'xaxis');
combined_S = [combined_S, Pi];
combined_T = [combined_T, Ti + combined_T(end)];
3. Then plot the combined spectrogram using “imagesc” function and further update the plot in each iteration of the loop to visualise the spectrogram built up gradually.
imagesc(combined_T / 60, Fi, 10 * log10(combined_S));
See the output below for better understanding :
For more details on the “spectrogram” and “imagesc” function, kindly refer to the following documentations:
Happy Coding!