How to combine multiple spectrogram and create a single image in MATLAB
조회 수: 15 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (1개)
Walter Roberson
2022년 9월 12일
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
Siriki Kone
2022년 9월 25일
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
2022년 9월 25일
s_rate=200;
dt=1/s_rate;
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');
참고 항목
카테고리
Help Center 및 File Exchange에서 Time-Frequency Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!