|
@ -2,7 +2,7 @@ |
|
|
% $DATE : 02-May-2018 17:21:18 $ |
|
|
% $DATE : 02-May-2018 17:21:18 $ |
|
|
% $Revision : 1.00 $ |
|
|
% $Revision : 1.00 $ |
|
|
% DEVELOPED : 9.0.0.341360 (R2016a) |
|
|
% DEVELOPED : 9.0.0.341360 (R2016a) |
|
|
% FILENAME : low_pass_design_single.m |
|
|
% FILENAME : low_pass_design.m |
|
|
% AEM : 8261 |
|
|
% AEM : 8261 |
|
|
|
|
|
|
|
|
%% ========== DESIGN SPECIFICATIONS START ========== |
|
|
%% ========== DESIGN SPECIFICATIONS START ========== |
|
@ -29,6 +29,17 @@ specification_stop_radial_frequency = ... |
|
|
specification_min_stop_attenuation = 23+(max(1,AEM(3))-5)*(3/4); % dB |
|
|
specification_min_stop_attenuation = 23+(max(1,AEM(3))-5)*(3/4); % dB |
|
|
specification_max_pass_attenuation = 0.6+((max(1,AEM(4))-5)/16); % dB |
|
|
specification_max_pass_attenuation = 0.6+((max(1,AEM(4))-5)/16); % dB |
|
|
|
|
|
|
|
|
|
|
|
% Outputs results |
|
|
|
|
|
fprintf(['\n' '===== DESIGN SPECIFICATIONS =====' '\n' ... |
|
|
|
|
|
'Filter design specifications:\n' ... |
|
|
|
|
|
'Pass frequency = %.3fHz = %.3frad/s\n' ... |
|
|
|
|
|
'Stop frequency = %.3fHz = %.3frad/s\n' ... |
|
|
|
|
|
'Min stop attenuation = %.3fdB\n' ... |
|
|
|
|
|
'Max pass attenuation = %.3fdB\n'], ... |
|
|
|
|
|
specification_pass_frequency, specification_pass_radial_frequency, ... |
|
|
|
|
|
specification_stop_frequency, specification_stop_radial_frequency, ... |
|
|
|
|
|
specification_min_stop_attenuation, specification_max_pass_attenuation); |
|
|
|
|
|
|
|
|
clear design_param_m |
|
|
clear design_param_m |
|
|
|
|
|
|
|
|
% ========== DESIGN SPECIFICATIONS END ========== |
|
|
% ========== DESIGN SPECIFICATIONS END ========== |
|
@ -39,13 +50,12 @@ clear design_param_m |
|
|
|
|
|
|
|
|
normalized_pass_radial_frequency = specification_pass_radial_frequency/ ... |
|
|
normalized_pass_radial_frequency = specification_pass_radial_frequency/ ... |
|
|
specification_stop_radial_frequency; % rad/s |
|
|
specification_stop_radial_frequency; % rad/s |
|
|
% normalized_stop_radial_frequency = 1; % Hz (stop_frequency/stop_frequency) |
|
|
|
|
|
|
|
|
|
|
|
% Calculates the filter's order using the eq. 9-137 |
|
|
% Calculates the filter's order using the eq. 9-137 |
|
|
design_filter_order = ceil( ... |
|
|
temp_filter_order = acosh(((10^(specification_min_stop_attenuation/10)-1)/ ... |
|
|
acosh(((10^(specification_min_stop_attenuation/10)-1)/ ... |
|
|
|
|
|
(10^(specification_max_pass_attenuation/10)-1))^(1/2)) ... |
|
|
(10^(specification_max_pass_attenuation/10)-1))^(1/2)) ... |
|
|
/acosh(1/normalized_pass_radial_frequency)); |
|
|
/acosh(1/normalized_pass_radial_frequency); |
|
|
|
|
|
design_filter_order = ceil(temp_filter_order); |
|
|
% Calculates epsilon parameter using the eq. 9-123 |
|
|
% Calculates epsilon parameter using the eq. 9-123 |
|
|
epsilon_parameter = 1/(10^(specification_min_stop_attenuation/10)-1)^(1/2); |
|
|
epsilon_parameter = 1/(10^(specification_min_stop_attenuation/10)-1)^(1/2); |
|
|
|
|
|
|
|
@ -57,11 +67,13 @@ design_half_power_radial_frequency = specification_stop_radial_frequency/ ... |
|
|
(cosh(acosh(1/epsilon_parameter)/design_filter_order)); % rad/s |
|
|
(cosh(acosh(1/epsilon_parameter)/design_filter_order)); % rad/s |
|
|
|
|
|
|
|
|
% ----- |
|
|
% ----- |
|
|
% Calculates stable poles, zeros, angles and other characteristic sizes |
|
|
% Calculates stable poles, zeros and other characteristic sizes using the |
|
|
% using the Guillemin algorithm |
|
|
% Guillemin algorithm |
|
|
% ----- |
|
|
% ----- |
|
|
|
|
|
|
|
|
% Initializes necessary variables |
|
|
% Initializes necessary variables |
|
|
|
|
|
% Calculates the number of poles. This counts the conjugate poles as one |
|
|
|
|
|
% (pair) and single, non-conjugate poles as one as well! |
|
|
design_number_of_poles = idivide(design_filter_order,int32(2),'ceil'); |
|
|
design_number_of_poles = idivide(design_filter_order,int32(2),'ceil'); |
|
|
% Creates five vector arrays of dimensions [1 * number_of_poles] filled |
|
|
% Creates five vector arrays of dimensions [1 * number_of_poles] filled |
|
|
% with zeros to store: |
|
|
% with zeros to store: |
|
@ -167,12 +179,51 @@ for i=1:2:design_filter_order |
|
|
temp_index = temp_index + 1; |
|
|
temp_index = temp_index + 1; |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
% Clears unneeded variable from workspace |
|
|
% Outputs results |
|
|
clearVars = {'theta', 'i', 'temp_index', 'alpha_parameter' ... |
|
|
fprintf(['\n' '===== NORMALIZED DESIGN =====' '\n' ... |
|
|
'epsilon_parameter', 'normalized_pass_radial_frequency'}; |
|
|
'Normalized pass radial frequency = %.3frad/s\n' ... |
|
|
|
|
|
'Filter order = %.3f\n' ... |
|
|
|
|
|
'Filter order ceiling = %d\n' ... |
|
|
|
|
|
'Epsilon parameter = %.3f\n' ... |
|
|
|
|
|
'Alpha parameter = %.3f\n' ... |
|
|
|
|
|
'Radial frequency at which half power occurs = %.3frad/s\n' ... |
|
|
|
|
|
'Butterworth angles are ' char(177) '%.2f' char(176) ' and ' ... |
|
|
|
|
|
char(177) '%.2f' char(176) '\n'], ... |
|
|
|
|
|
normalized_pass_radial_frequency, temp_filter_order, ... |
|
|
|
|
|
design_filter_order, epsilon_parameter, alpha_parameter, ... |
|
|
|
|
|
design_half_power_radial_frequency, design_butterworth_angles(1,1), ... |
|
|
|
|
|
design_butterworth_angles(1,2)); |
|
|
|
|
|
|
|
|
|
|
|
fprintf('\nChebyshev poles found:\n'); |
|
|
|
|
|
for i=1:design_number_of_poles |
|
|
|
|
|
fprintf(['Pole %d:\t' '%.3f' char(177) ... |
|
|
|
|
|
'%.3fi, radial frequency = %.3f, Q = %.3f\n'], ... |
|
|
|
|
|
i, chebyshev_poles_real_parts(1,i), ... |
|
|
|
|
|
chebyshev_poles_imaginary_parts(1,i), ... |
|
|
|
|
|
chebyshev_poles_radial_frequencies(1,i), ... |
|
|
|
|
|
inverse_chebyshev_poles_Q(1,i)); |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
fprintf('\nInverse chebyshev poles found:\n'); |
|
|
|
|
|
for i=1:design_number_of_poles |
|
|
|
|
|
fprintf(['Pole %d:\t' 'radial frequency = %.3f, Q = %.3f\n'], ... |
|
|
|
|
|
i, inverse_chebyshev_poles_radial_frequencies(1,i), ... |
|
|
|
|
|
inverse_chebyshev_poles_Q(1,i)); |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
fprintf('\nTransfer function zeros:\n'); |
|
|
|
|
|
for i=1:length(inverse_chebyshev_transfer_function_zeros) |
|
|
|
|
|
fprintf(['Zero %d:\t' '0' char(177) '%.3fi\n'], ... |
|
|
|
|
|
i, inverse_chebyshev_transfer_function_zeros(1,i)); |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
% Clears unneeded variables from workspace |
|
|
|
|
|
clearVars = {'theta', 'i', 'alpha_parameter', 'epsilon_parameter', ... |
|
|
|
|
|
'normalized_pass_radial_frequency'}; |
|
|
clear(clearVars{:}) |
|
|
clear(clearVars{:}) |
|
|
clear clearVars |
|
|
clear clearVars |
|
|
clear -regexp ^chebyshev_ |
|
|
clear -regexp ^chebyshev_ |
|
|
|
|
|
clear -regexp ^temp_ |
|
|
|
|
|
|
|
|
% ========== NORMALIZED DESIGN END ========== |
|
|
% ========== NORMALIZED DESIGN END ========== |
|
|
|
|
|
|
|
@ -303,7 +354,39 @@ for i=1:design_number_of_poles |
|
|
unit_low_pass_notch_gains_high(1,i); |
|
|
unit_low_pass_notch_gains_high(1,i); |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
% Clears unneeded variable from workspace |
|
|
% Outputs results |
|
|
|
|
|
fprintf(['\n' '===== UNITS IMPLEMENTATION =====' '\n' ... |
|
|
|
|
|
'Units implementation details:\n']); |
|
|
|
|
|
for i=1:design_number_of_poles |
|
|
|
|
|
fprintf(['Unit %d:\n' ... |
|
|
|
|
|
'\tPole radial frequency = %.3f\n'... |
|
|
|
|
|
'\tPole Q = %.3f\n' ... |
|
|
|
|
|
'\tTransfer function zero = %.3f\n' ... |
|
|
|
|
|
'\tCircuit elements:\n' ... |
|
|
|
|
|
'\t\tR1 = %.3fOhm\n' ... |
|
|
|
|
|
'\t\tR2 = %.3fOhm\n' ... |
|
|
|
|
|
'\t\tR3 = %.3fOhm\n' ... |
|
|
|
|
|
'\t\tR4 = %.3fOhm\n' ... |
|
|
|
|
|
'\t\tR5 = %.3fOhm\n' ... |
|
|
|
|
|
'\t\tC1 = %.7fF\n' ... |
|
|
|
|
|
'\t\tC2 = %.7fF\n' ... |
|
|
|
|
|
'\tUnit gain at low frequencies = %.3f\n' ... |
|
|
|
|
|
'\tUnit gain at high frequencies = %.3f\n'], ... |
|
|
|
|
|
i, inverse_chebyshev_poles_radial_frequencies(1,i), ... |
|
|
|
|
|
inverse_chebyshev_poles_Q(1,i), ... |
|
|
|
|
|
inverse_chebyshev_transfer_function_zeros(1,i), ... |
|
|
|
|
|
unit_low_pass_notch_resistors_1(1,i), ... |
|
|
|
|
|
unit_low_pass_notch_resistors_2(1,i), ... |
|
|
|
|
|
unit_low_pass_notch_resistors_3(1,i), ... |
|
|
|
|
|
unit_low_pass_notch_resistors_4(1,i), ... |
|
|
|
|
|
unit_low_pass_notch_resistors_5(1,i), ... |
|
|
|
|
|
unit_low_pass_notch_capacitors(1,i), ... |
|
|
|
|
|
unit_low_pass_notch_capacitors(1,i), ... |
|
|
|
|
|
unit_low_pass_notch_gains_low(1,i), ... |
|
|
|
|
|
unit_low_pass_notch_gains_high(1,i)); |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
% Clears unneeded variables from workspace |
|
|
clearVars = {'normalized_transfer_function_zero', 'i'}; |
|
|
clearVars = {'normalized_transfer_function_zero', 'i'}; |
|
|
clear(clearVars{:}) |
|
|
clear(clearVars{:}) |
|
|
clear clearVars |
|
|
clear clearVars |
|
@ -319,6 +402,13 @@ unit_adjustment_gain = 1/total_fried_units_attenuation; |
|
|
% unit |
|
|
% unit |
|
|
unit_adjustment_feedback_resistor = 10*10^3*unit_adjustment_gain; |
|
|
unit_adjustment_feedback_resistor = 10*10^3*unit_adjustment_gain; |
|
|
|
|
|
|
|
|
|
|
|
fprintf(['\n' '===== GAIN ADJUSTMENT =====' '\n' ... |
|
|
|
|
|
'A gain adjustment unit is needed to achieve 0dB attenuation at ' ... |
|
|
|
|
|
'pass band.\n' ... |
|
|
|
|
|
'We arbitrarily choose to use a 10KOhm series resistor.\n' ... |
|
|
|
|
|
'The feedback resistor is %.3fOhm to get a gain equal to %.3fdB\n'], ... |
|
|
|
|
|
unit_adjustment_feedback_resistor, unit_adjustment_gain); |
|
|
|
|
|
|
|
|
% ========== GAIN ADJUSTMENT END ========== |
|
|
% ========== GAIN ADJUSTMENT END ========== |
|
|
|
|
|
|
|
|
%% ========== TRANSFER FUNCTIONS START ========== |
|
|
%% ========== TRANSFER FUNCTIONS START ========== |
|
@ -338,8 +428,8 @@ plot_transfer_function(total_transfer_function, ... |
|
|
%ltiview(unit_transfer_function(1,1)); |
|
|
%ltiview(unit_transfer_function(1,1)); |
|
|
%ltiview(unit_transfer_function(1,2)); |
|
|
%ltiview(unit_transfer_function(1,2)); |
|
|
%ltiview(total_transfer_function); |
|
|
%ltiview(total_transfer_function); |
|
|
ltiview(unit_transfer_function(1,1), unit_transfer_function(1,2), ... |
|
|
%ltiview(unit_transfer_function(1,1), unit_transfer_function(1,2), ... |
|
|
total_transfer_function); |
|
|
%total_transfer_function); |
|
|
|
|
|
|
|
|
% Clears unneeded variable from workspace |
|
|
% Clears unneeded variable from workspace |
|
|
clear -regexp _numerator$ |
|
|
clear -regexp _numerator$ |
|
|