用于水平均值滤波器的matlab代码

时间:2010-04-07 01:44:46

标签: matlab

如何在matlab中将水平均值滤波器应用于频谱图?

1 个答案:

答案 0 :(得分:1)

有很多方法。例如,您可以使用conv

对于一维频谱图:

%# create some sample data
spectrogram = randn(1,1000); %# row vector of length 1000 with random values

%# define filter window
windowSize = 5; %# size of filter window

%# filter
filteredSpectrogram = conv(spectrogram,ones(1,windowSize)/windowSize,'same');

对于2D频谱图(和仅水平滤波器)

%# create some sample data
spectrogram = randn(100,1000); %# 100 rows, 1000 cols of random values

%# define filter window
windowSize = 5; %# size of filter window

%# filter
filteredSpectrogram = conv2(spectrogram,ones(1,windowSize)/windowSize,'same');