Changing Y limit of spectogram

39 ビュー (過去 30 日間)
SS
SS 2017 年 4 月 4 日
回答済み: Farid 2021 年 4 月 4 日
Hi, I am drawing spectogram of a sound signal by the following code:
spectrogram(seg,segmentLength,noverlap,segmentLength,sample_freq,'yaxis');
This code generates a spectogram with y axis of 0 to 7 kHz. I want to change the y limit to 0 to 3 kHz. I have tried both of the following. But, they didn't work.
ylim([0 3]);
set(gca,'YLim',[0 3]);
Can you please tell me how to change the y limit of a spectogram. Thansk
  2 件のコメント
Aditya Rastogi
Aditya Rastogi 2021 年 3 月 13 日
spectrogram(my_sound, hann(int64(0.0256 * sampling_rate)), int64(0.0128 * sampling_rate),[0:20000],sampling_rate,'yaxis');
In this statement, I'm using a hanning window with half overlap. Here, the parameter [0:20000] (denoted by f in the documentation), is the range of frequencies I want in the spectrogram.
In your case, you need to pass [0:3000] to this parameter.
Farid
Farid 2021 年 4 月 4 日
Thank you Aditya but the code won't work. did you try it by yourself?

サインインしてコメントする。

回答 (1 件)

Farid
Farid 2021 年 4 月 4 日
ylim([0 fmax]) worked for me perfectly, You probably have not used clc; clear in the beginning.
I know it's too late now but anyway :))

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by