我一直在尝试在MATLAB上实现这个过滤器,我只知道它的频率响应:HW =((3 * c * 1i *(J0))./(2 * rfg * W))+(( (3 * 2 * rfg *(W. * J1)) - (3 * 3 * c * 1i * J1))./(2 * a lambda rfg * W. ^ 2))其中J0和J1分别是0和1阶的球形贝塞尔函数。
如何使用频率响应在时域中实现它?
/Org/freedesktop/ModeManager1/Modem/12 [Generic] MBIM [8087:0911]
感谢。
答案 0 :(得分:0)
这是你在找什么?
a = 0.1; %radius of a spherical zone in m
%Data
c = 344; %speed of sound
rf = 3; %location of primary sound source
phi_f = degtorad(0); % "
rg = 1; %location of secondary sound source
phi_g = degtorad(45); % "
rfg = 1/((1/rg)-(1/rf));
lambda = - (2/c) * sin( (phi_f - phi_g)/2 );
Fs = 20000; % Sampling frequency (largest frequency in the frequency domain)
dt = 1/Fs; % Sampling time step (period)
N = 200000; % Number of points in the signal
t = (0:N-1)*dt; % Time vector
df = 1/(N*dt); % Frequency step
f = 0:df:(Fs/2); % Frequency vector in Hz
W = 2*pi*f; %Angular frequency vector (rad/sec)
%Bessel Functions
J0 = sphbes(0, a*lambda*W);
J1 = sphbes(1, a*lambda*W);
% Filter
HW = ( (3*c*1i*(J0))./(2*rfg*W) ) + (( (3*2*rfg*(W.*J1))-(3*3*c*1i*J1) ) ./ (2*a*lambda*rfg*W.^2) );
HW(1) = HW(2); % the value is NaN at f = 0
% visualising
figure(1);
cla(gca);
hold on;
plot(f, real(HW));
plot(f, imag(HW));
plot(f, abs(HW));
hold off;
xlabel('Frequency (Hz)');
ylabel('Amplitude');
legend({'Real', 'Imaginary', 'Absolute'});
box on;
% Convert from single sided to two sided
P1 = HW;
P1_flipped = fliplr(P1);
P2 = [P1(1:end-1) P1_flipped(1:end-1)];
P2 = P2/2;
% do the inverse fft
time_domain = ifft(P2);
% visualising
figure(2);
cla(gca);
hold on;
plot(t*1000, real(time_domain));
plot(t*1000, imag(time_domain));
plot(t*1000, abs(time_domain));
hold off;
xlabel('time (msec)');
ylabel('Amplitude');
legend({'Real', 'Imaginary', 'Absolute'});
box on;
xlim([0 10]);
ylim([-18*10^(-5) 18*10^(-5)]);