From e1e23bfc1f5b0e920bf41c3cf5c3cf8ac904105d Mon Sep 17 00:00:00 2001 From: Apostolof Date: Mon, 13 Aug 2018 21:55:09 +0300 Subject: [PATCH] Band pass individual units transfer functions fix --- Band Pass Chebyshev/band_pass_design.m | 51 +++++++++++++------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/Band Pass Chebyshev/band_pass_design.m b/Band Pass Chebyshev/band_pass_design.m index 429a684..ca38a59 100644 --- a/Band Pass Chebyshev/band_pass_design.m +++ b/Band Pass Chebyshev/band_pass_design.m @@ -291,14 +291,14 @@ clear -regexp ^transformation_ units_BW = zeros([1 band_pass_number_of_poles]); units_C21 = zeros([1 band_pass_number_of_poles]); units_C22 = zeros([1 band_pass_number_of_poles]); -units_R21 = zeros([1 band_pass_number_of_poles]); -units_R22 = zeros([1 band_pass_number_of_poles]); +units_R1 = zeros([1 band_pass_number_of_poles]); +units_R2 = zeros([1 band_pass_number_of_poles]); units_frequency_scale_factors = zeros([1 band_pass_number_of_poles]); units_amplitude_scale_factors = zeros([1 band_pass_number_of_poles]); units_central_frequency_gain = zeros([1 band_pass_number_of_poles]); units_alpha = zeros([1 band_pass_number_of_poles]); -units_Z22 = zeros([1 band_pass_number_of_poles]); -units_Z23 = zeros([1 band_pass_number_of_poles]); +units_Z2 = zeros([1 band_pass_number_of_poles]); +units_Z3 = zeros([1 band_pass_number_of_poles]); unit_transfer_function = [tf(1) tf(1) tf(1) tf(1)]; for i=1:band_pass_number_of_poles @@ -309,9 +309,9 @@ for i=1:band_pass_number_of_poles units_C21(1,i) = 1/(2*band_pass_poles_Q(1,i)); units_C22(1,i) = units_C21(1,i); % Using the eq. 7-86 - units_R21(1,i) = 1; + units_R1(1,i) = 1; % Calculates R12 using the eq. 7-87 - units_R22(1,i) = 4*band_pass_poles_Q(1,i)^2; + units_R2(1,i) = 4*band_pass_poles_Q(1,i)^2; % Selects the appropriate frequency scale factor to transfer the % normalized radial frequency back to the original @@ -325,8 +325,8 @@ for i=1:band_pass_number_of_poles % Scales the circuit elements units_C21(1,i) = 0.1*10^(-6); units_C22(1,i) = 0.1*10^(-6); - units_R21(1,i) = units_amplitude_scale_factors(1,i); - units_R22(1,i) = units_R22(1,i)*units_amplitude_scale_factors(1,i); + units_R1(1,i) = units_amplitude_scale_factors(1,i); + units_R2(1,i) = units_R2(1,i)*units_amplitude_scale_factors(1,i); % Calculates the gain at the central radial frequency and the alpha % parameter using the eq. 7-89 @@ -336,16 +336,16 @@ for i=1:band_pass_number_of_poles % Calculates the values of the resistors used to diminish the entry % using the eq. 7-90 (to include the scaling already done the equations % are used in the form presented at example 7.2) - units_Z22(1,i) = units_R21(1,i)/units_alpha(1,i); - units_Z23(1,i) = units_R21(1,i)/(1-units_alpha(1,i)); + units_Z2(1,i) = units_R1(1,i)/units_alpha(1,i); + units_Z3(1,i) = units_R1(1,i)/(1-units_alpha(1,i)); + unit_Z_parallel = (units_Z2(1,i)*units_Z3(1,i))/(units_Z2(1,i)+units_Z3(1,i)); - %TODO: build the tfs % - unit_numerator = [-1/(units_R21(1,i)*units_C21(1,i)) ... + unit_numerator = [-1/(units_Z2(1,i)*units_C21(1,i)) ... 0]; unit_denominator = [1 ... - (2/units_C21(1,i))/units_R22(1,i) ... - 1/(units_R22(1,i)*units_R21(1,i)*units_C21(1,i)^2)]; + (2/units_C21(1,i))/units_R2(1,i) ... + 1/(units_R2(1,i)*unit_Z_parallel*units_C21(1,i)^2)]; % %{ unit_numerator = [-2*band_pass_poles_Q(1,i)^2*units_BW(1,i) ... @@ -357,29 +357,30 @@ for i=1:band_pass_number_of_poles unit_transfer_function(i) = tf(unit_numerator, unit_denominator); end -total_transfer_function = series(series(series(unit_transfer_function(1), ... - unit_transfer_function(2)), unit_transfer_function(3)), ... - unit_transfer_function(4)); +total_transfer_function = series(series(series( ... + unit_transfer_function(1), unit_transfer_function(2)), ... + unit_transfer_function(3)), unit_transfer_function(4)); %total_transfer_function = total_transfer_function*38.2; +%plot_transfer_function(unit_transfer_function(2), [1 10]); +%ltiview(unit_transfer_function(1), unit_transfer_function(2), ... +% unit_transfer_function(3), unit_transfer_function(4), total_transfer_function); + +%ltiview(total_transfer_function); + %{ plot_transfer_function(total_transfer_function, ... - [1 ... + [specification_central_frequency ... + 941.83 ... specification_low_stop_frequency ... specification_low_pass_frequency ... - 900 ... specification_high_pass_frequency ... specification_high_stop_frequency]); %} -%plot_transfer_function(unit_transfer_function(2), [1 10]); -%ltiview(unit_transfer_function(1), unit_transfer_function(2), ... -% unit_transfer_function(3), unit_transfer_function(4)); - -%ltiview(total_transfer_function); % Clears unneeded variables from workspace clearVars = {'units_central_frequency_gain', 'i', 'units_alpha', ... - 'unit_denominator', 'unit_numerator', ... + 'unit_denominator', 'unit_numerator', 'unit_Z_parallel' ... 'units_amplitude_scale_factors', 'units_frequency_scale_factors'}; clear(clearVars{:}) clear clearVars