How to combine multiple spectrogram and create a single image in MATLAB

32 visualizaciones (últimos 30 días)
Hello I hope you are doing well. I have the 3 vectors. I want to create a spectrogram of each vectors first save the spectrogram.
and combine the three vectors to create a single overlap spectrogram and save as image file
How can i do it in MATLAB

Respuestas (1)

Walter Roberson
Walter Roberson el 12 de Sept. de 2022
When you permit spectrogram() to display the result, then it always clears the axes it is drawing in. spectrogram() does not just display the result: the output has active controls.
Because of this, if you let spectrogram() display the output, you cannot merge the results at all easily.
What you can do is ask for outputs from spectrogram(), and use the outputs to draw the results any way that is appropriate for you.
But perhaps I am misunderstanding you. Perhaps what you want to do is something more like
combined_signal = mean([first_signal(:), second_signal(:), third_signal(:)], 2);
This assumes that they are all the same length; if not then you will need to pad the shorter ones first.
  13 comentarios
Siriki Kone
Siriki Kone el 25 de Sept. de 2022
Do you mean it would the cause of these errors? because was always n=1 but it doesnt change anything, i get the same errors.
Actually I first add my acc with dimensions (:,13) because i subdivised each data in 13 segments. I estimate then the power spectral density for each of them (PSD_Station=10*log10(acc(:,n)); the problem is that i don't know how to plot these psd as an image with time against frequency, i tried with surf, or imagesc but it didnt work.
any solution would be really helpful!
Walter Roberson
Walter Roberson el 25 de Sept. de 2022
n = 1;
nov = length(acc(:,n)); %my acc has the dimensions (262144,1)
section1 = ceil(nov/13); %window my acc data in 13 segments
window1 = hanning(section1); %apply a hanning fenster on it
noverlap1 = ceil(3*section1/4); %75% overlapping
f= [0 100]; %my frequencies go from 0 30-40 Hz so i choose to take max f intervall
[s,f,t,psd] =spectrogram(acc,section1,noverlap1,f,s_rate,'psd');

Iniciar sesión para comentar.




Community Treasure Hunt

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

Start Hunting!

Translated by