📄 calc_parameters.m
字号:
%% calc_parameters.m
%%
% This function takes the user input and makes it a bit more usable for the
% rest of the functions. Given the lowest center frequency, highest center
% frequency, a filter scalar or vector, a band pass gain scalar or vector,
% and the number of filters in the equalizer, return a vector of angular
% frequencies, qualities, band pass gains, and a scalar representing the
% number of filters.
function [w0,q0,hbp,n] = calc_parameters(f01,f02,q0,hbp,n)
%%
%% Center frequency selection
%%
% We would like to have the center frequencies of the fitlers evenly
% spaced (logarithmically) in frequency. The follwoing code accomplishes
% this.
%for the specificed frequency range, choose the
%cetner frequencies of the filters.
low_freq = log10(2*pi*f01);
high_freq = log10(2*pi*f02);
w0 = logspace(low_freq,high_freq,n);
%%
%% Quality and band pass gain vector creation
%%
% The user can enter either a scalar or a vector for the quality of each
% filter. If a scalar is entered, the scalar will be copied to a vector of
% length n, where n reprensents the number of fitlers in the equalizer
%if the user supplied a single value, extend the vector
%to n. each entry will be the specified value.
if (length(q0) < n)
for filter_n = 1:n
q0(filter_n) = q0(1);
end
end
%same idea here
if (length(hbp) < n)
for filter_n = 1:n
hbp(filter_n) = hbp(1);
end
end
%haha
n = n;
end
%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -