diff --git a/Band Elimination Chebyshev/band_elimination_design.m b/Band Elimination Chebyshev/band_elimination_design.m index f814b93..3b9a616 100644 --- a/Band Elimination Chebyshev/band_elimination_design.m +++ b/Band Elimination Chebyshev/band_elimination_design.m @@ -366,4 +366,144 @@ clear clearVars clear -regexp ^high_pass_prototype_ clear -regexp ^geffe_ clear -regexp ^transformation_ -% ========== POLES TRANSFORMATION END ========== \ No newline at end of file +% ========== POLES TRANSFORMATION END ========== + +%% ========== ZEROS-POLES GROUPING START ========== + +% Grouping is done "by hand". + +% ------------------------------------------------------------------------- +% Unit 1 has a pole pair with ±73.41 degrees of angle, Q equal to 1.751, +% the pole pair lies on a circle with a radius equal to 21505.94 and is +% grouped with a zero at 0.0 + 15707.96 i, resulting in a high pass notch. +% ------------------------------------------------------------------------- +% Unit 2 has a pole pair with ±73.41 degrees of angle, Q equal to 1.751, +% the pole pair lies on a circle with a radius equal to 11473.11 and is +% grouped with a zero at 0.0 + 15707.96 i, resulting in a low pass notch. +% ------------------------------------------------------------------------- +% Unit 3 has a pole pair with ±87.73 degrees of angle, Q equal to 12.67, +% the pole pair lies on a circle with a radius equal to 19957.29 and is +% grouped with a zero at 0.0 + 15707.96 i, resulting in a high pass notch. +% ------------------------------------------------------------------------- +% Unit 4 has a pole pair with ±87.73 degrees of angle, Q equal to 12.67, +% the pole pair lies on a circle with a radius equal to 12363.40 and is +% grouped with a zero at 0.0 + 15707.96 i, resulting in a low pass notch. +% ------------------------------------------------------------------------- + +% Two low pass notch units are required to implement the desired band +% elimination filter. + +% ========== ZEROS-POLES GROUPING END ========== + +%% ========== UNITS IMPLEMENTATION START ========== +% AEM(3) = 6, so the circuits shown in 7.21 and 7.23 are going to be used +% for the low pass notch units. + +% High pass notch units 1 and 3 +% Initializes necessary arrays, each array is 1X2, the first element (1,1) +% corresponds to the first unit (unit 1) and the second element (1,2) to +% second unit (unit 3). +high_pass_notch_units_k1 = zeros([1 2]); +high_pass_notch_units_k2 = zeros([1 2]); +high_pass_notch_units_gain_high = zeros([1 2]); +high_pass_notch_units_C = zeros([1 2]); +high_pass_notch_units_C1 = zeros([1 2]); +high_pass_notch_units_R1 = zeros([1 2]); +high_pass_notch_units_R2 = zeros([1 2]); +high_pass_notch_units_R3 = zeros([1 2]); +high_pass_notch_units_R4 = zeros([1 2]); +high_pass_notch_units_frequency_scale_factors = zeros([1 2]); +high_pass_notch_units_amplitude_scale_factors = zeros([1 2]); +high_pass_notch_units_transfer_functions = [tf(1) tf(1)]; + +for i=1:2 + unit_index = i*2-1; + % Calculates k1 design parameter using the eq. 7-135 + high_pass_notch_units_k1(1,i) = ... + band_elimination_poles_radial_frequencies(1,unit_index)^2/ ... + abs(band_elimination_transfer_function_zeros(1,i))^2-1; + % Calculates k2 design parameter using the eq. 7-136 + temp = (2+high_pass_notch_units_k1(1,i))* ... + band_elimination_poles_Q(1,unit_index)^2; + high_pass_notch_units_k2(1,i) = temp/(temp+1); + % Calculates k (unit's gain at high frequencies) using the eq. 7-137 + high_pass_notch_units_gain_high(1,i) = high_pass_notch_units_k2(1,i)* ... + (band_elimination_poles_radial_frequencies(1,unit_index)^2/ ... + abs(band_elimination_transfer_function_zeros(1,i))^2); + % Calculates R2 using the eq. 7-138 + high_pass_notch_units_R2(1,i) = band_elimination_poles_Q(1,unit_index)^2* ... + (high_pass_notch_units_k1(1,i)+2)^2; + % Assumes that R3 is 1 Ohm and the radial frequency is 1 rad/s + high_pass_notch_units_R3(1,i) = 1; + % Calculates R4 using the eq. 7-139 + high_pass_notch_units_R4(1,i) = (high_pass_notch_units_k1(1,i)+2)* ... + band_elimination_poles_Q(1,unit_index)^2; + % Calculates C using the eq. 7-140 + high_pass_notch_units_C(1,i) = 1/ ... + (band_elimination_poles_Q(1,unit_index)* ... + (high_pass_notch_units_k1(1,i)+2)); + % Initial axioms of the design were: + % C1 = k1 * C + high_pass_notch_units_C1(1,i) = high_pass_notch_units_k1(1,i)* ... + high_pass_notch_units_C(1,i); + % R1 = 1 Ohm + high_pass_notch_units_R1(1,i) = 1; + + % Selects the appropriate frequency scale factor to transfer the + % normalized radial frequency back to the original + high_pass_notch_units_frequency_scale_factors(1,i) = ... + band_elimination_poles_radial_frequencies(1,unit_index); + % AEM(3) = 6, so the magnitude scaling will be performed to achieve a + % capacitor value of 0.1uF using the eq. 6-33 + high_pass_notch_units_amplitude_scale_factors(1,i) = ... + high_pass_notch_units_C(1,i)/ ... + (high_pass_notch_units_frequency_scale_factors(1,i)*0.1*10^(-6)); + + % Performs scaling + high_pass_notch_units_R1(1,i) = high_pass_notch_units_R1(1,i)* ... + high_pass_notch_units_amplitude_scale_factors(1,i); + high_pass_notch_units_R2(1,i) = high_pass_notch_units_R2(1,i)* ... + high_pass_notch_units_amplitude_scale_factors(1,i); + high_pass_notch_units_R3(1,i) = high_pass_notch_units_R3(1,i)* ... + high_pass_notch_units_amplitude_scale_factors(1,i); + high_pass_notch_units_R4(1,i) = high_pass_notch_units_R4(1,i)* ... + high_pass_notch_units_amplitude_scale_factors(1,i); + high_pass_notch_units_C(1,i) = high_pass_notch_units_C(1,i)/ ... + (high_pass_notch_units_frequency_scale_factors(1,i)* ... + high_pass_notch_units_amplitude_scale_factors(1,i)); + high_pass_notch_units_C1(1,i) = high_pass_notch_units_C1(1,i)/ ... + (high_pass_notch_units_frequency_scale_factors(1,i)* ... + high_pass_notch_units_amplitude_scale_factors(1,i)); + + % Builds unit's transfer function + high_pass_notch_unit_numerator = [1 ... + 0 ... + 1/(high_pass_notch_units_R2(1,i)*high_pass_notch_units_C(1,i)^2* ... + (high_pass_notch_units_k1(1,i)+1))]; + high_pass_notch_unit_denominator = [1 ... + (2+high_pass_notch_units_k1(1,i))/ ... + (high_pass_notch_units_R2(1,i)*high_pass_notch_units_C(1,i)) ... + 1/(high_pass_notch_units_R2(1,i)*high_pass_notch_units_C(1,i)^2)]; + + high_pass_notch_units_transfer_functions(1,i) = tf( ... + high_pass_notch_unit_numerator, high_pass_notch_unit_denominator); + high_pass_notch_units_transfer_functions(1,i) = ... + high_pass_notch_units_transfer_functions(1,i)* ... + high_pass_notch_units_gain_high(1,i); +end + +plot_transfer_function(high_pass_notch_units_transfer_functions(1,1)); +%ltiview(high_pass_notch_units_transfer_functions(1,1)); + +%{ +ltiview(high_pass_notch_units_transfer_functions(1,1), ... + high_pass_notch_units_transfer_functions(1,2), ... + series(high_pass_notch_units_transfer_functions(1,1), ... + high_pass_notch_units_transfer_functions(1,2))); +%} + +% ========== UNITS IMPLEMENTATION END ========== + + + + diff --git a/Low Pass Inverse Chebyshev/low_pass_design_single.m b/Low Pass Inverse Chebyshev/low_pass_design_single.m index 876047d..36b6f4a 100644 --- a/Low Pass Inverse Chebyshev/low_pass_design_single.m +++ b/Low Pass Inverse Chebyshev/low_pass_design_single.m @@ -5,7 +5,7 @@ % FILENAME : low_pass_design_single.m % AEM : 8261 -% ========== DESIGN SPECIFICATIONS START ========== +%% ========== DESIGN SPECIFICATIONS START ========== % Figures out design specifications according to my AEM number AEM = [8 2 6 1]; @@ -35,7 +35,7 @@ specification_min_stop_attenuation = 18; % dB specification_max_pass_attenuation = 0.25; % dB % ========== DESIGN SPECIFICATIONS END ========== -% ========== NORMALIZED DESIGN START ========== +%% ========== NORMALIZED DESIGN START ========== % Calculates normalized design specifications and designs a normalized % filter using them @@ -168,7 +168,7 @@ clear clearVars % ========== NORMALIZED DESIGN END ========== -% ========== ZEROS-POLES GROUPING START ========== +%% ========== ZEROS-POLES GROUPING START ========== % Grouping is done "by hand". The first pole, that has a radial frequency % equal to 0.9631, is grouped with the first zero (1.0824) and the second @@ -178,7 +178,7 @@ clear clearVars % ========== ZEROS-POLES GROUPING END ========== -% ========== UNITS IMPLEMENTATION START ========== +%% ========== UNITS IMPLEMENTATION START ========== % AEM(3) = 6, so the circuit shown in 7.23 is going to be used for the low % pass notch units. @@ -259,7 +259,7 @@ clear normalized_transfer_function_zero % ========== UNITS IMPLEMENTATION END ========== -% ========== DENORMALIZATION START ========== +%% ========== DENORMALIZATION START ========== % Unit sizes rescale unit_frequency_scale_factors = zeros([1 2]); @@ -307,7 +307,7 @@ unit_low_pass_notch_capacitors(1,2) = 0.1*10^(-6); % Farad % ========== DENORMALIZATION END ========== -% ========== GAIN ADJUSTMENT START ========== +%% ========== GAIN ADJUSTMENT START ========== total_fried_units_attenuation = unit_low_pass_notch_gains_low(1,1)*unit_low_pass_notch_gains_low(1,2); unit_adjustment_gain = 1/total_fried_units_attenuation; @@ -317,7 +317,7 @@ unit_adjustment_feedback_resistor = 10*10^3*unit_adjustment_gain; % ========== GAIN ADJUSTMENT END ========== -% ========== TRANSFER FUNCTIONS START ========== +%% ========== TRANSFER FUNCTIONS START ========== % Builds numerator and denominator of the transfer function of each unit % using the eq. 7-146, 7-147 & 7-148