📄 bandpass.m.svn-base
字号:
function output_wave = bandpass(wave_vector, low_pass, high_pass, sampling_rate);
%Does some band pass filtering on the data
%inputs
%wave vector is a row vector of the input waveform
%low_pass is the low pass frequency in Hz
%high_pass is the high pass frequency in Hz
%sampling rate is rate of sampling in Hz
%outputs
%output_wave
wave_samples = size(wave_vector, 2);
fourier = fft(wave_vector);
%Filter out the frequencies
%The maximum frequency we can have is equal to the sampling rate and we
%have wave_samples frequencies, so each element of the fft is
%sampling/wave_samples Hz.
for(i=1:wave_samples)
if(i*(sampling_rate/wave_samples) < low_pass || i*(sampling_rate/wave_samples) > high_pass)
fourier(i) = 0;
end
end
output_wave = real(ifft(fourier));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -