How to combine multiple spectrogram and create a single image in MATLAB
11 ビュー (過去 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!