Browse Source

Low pass output init

master
Apostolos Fanakis 6 years ago
parent
commit
71659b46db
  1. 116
      Low Pass Inverse Chebyshev/low_pass_design.m

116
Low Pass Inverse Chebyshev/low_pass_design.m

@ -2,7 +2,7 @@
% $DATE : 02-May-2018 17:21:18 $
% $Revision : 1.00 $
% DEVELOPED : 9.0.0.341360 (R2016a)
% FILENAME : low_pass_design_single.m
% FILENAME : low_pass_design.m
% AEM : 8261
%% ========== 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_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
% ========== DESIGN SPECIFICATIONS END ==========
@ -39,13 +50,12 @@ clear design_param_m
normalized_pass_radial_frequency = specification_pass_radial_frequency/ ...
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
design_filter_order = ceil( ...
acosh(((10^(specification_min_stop_attenuation/10)-1)/ ...
temp_filter_order = acosh(((10^(specification_min_stop_attenuation/10)-1)/ ...
(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
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
% -----
% Calculates stable poles, zeros, angles and other characteristic sizes
% using the Guillemin algorithm
% Calculates stable poles, zeros and other characteristic sizes using the
% Guillemin algorithm
% -----
% 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');
% Creates five vector arrays of dimensions [1 * number_of_poles] filled
% with zeros to store:
@ -167,12 +179,51 @@ for i=1:2:design_filter_order
temp_index = temp_index + 1;
end
% Clears unneeded variable from workspace
clearVars = {'theta', 'i', 'temp_index', 'alpha_parameter' ...
'epsilon_parameter', 'normalized_pass_radial_frequency'};
% Outputs results
fprintf(['\n' '===== NORMALIZED DESIGN =====' '\n' ...
'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 -regexp ^chebyshev_
clear -regexp ^temp_
% ========== NORMALIZED DESIGN END ==========
@ -303,7 +354,39 @@ for i=1:design_number_of_poles
unit_low_pass_notch_gains_high(1,i);
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'};
clear(clearVars{:})
clear clearVars
@ -319,6 +402,13 @@ unit_adjustment_gain = 1/total_fried_units_attenuation;
% unit
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 ==========
%% ========== TRANSFER FUNCTIONS START ==========
@ -338,8 +428,8 @@ plot_transfer_function(total_transfer_function, ...
%ltiview(unit_transfer_function(1,1));
%ltiview(unit_transfer_function(1,2));
%ltiview(total_transfer_function);
ltiview(unit_transfer_function(1,1), unit_transfer_function(1,2), ...
total_transfer_function);
%ltiview(unit_transfer_function(1,1), unit_transfer_function(1,2), ...
%total_transfer_function);
% Clears unneeded variable from workspace
clear -regexp _numerator$

Loading…
Cancel
Save