【发布时间】:2015-12-25 11:04:19
【问题描述】:
我需要录制音频信号,然后将其转换为频谱形式,然后对其进行过滤。
这就是我记录信号并将其转换为频谱的方式:
% Record your voice for 10 seconds.
recObj = audiorecorder;
disp('Start speaking.')
recordblocking(recObj,10);
disp('End of Recording.');
% Play back the recording.
play(recObj);
% Store data in double-precision array.
myRecording = getaudiodata(recObj);
% Plot the waveform.
figure
plot(myRecording);
fs = 48000;
% get the spectrum.
x=myRecording;
xf=fftshift(fft(x)*(1/fs));
figure
plot(real(xf));
现在我想过滤任何大于 4k 的光谱 我使用了一个零和一个理想过滤 但它总是给我(次 矩阵尺寸必须一致)。而且我不知道怎么解决!
% Here is my Ideal filter
n1=-80000:-4000;
n2=-4000:4000;
n3=4000:80000;
n=[n1 n2 n3];
x1=zeros(1,length(n1));
x2=ones(1,length(n2));
x3=zeros(1,length(n3));
x=[x1 x2 x3];
y=x.*xf;
figure
plot(n,y);
【问题讨论】:
-
你在哪一行得到这个错误?
-
@dfri 当我使用此行进行过滤时:y=x.*xf;
标签: matlab signals communication