Index-> contents reference index search Up-> SPT_HELP AnalogFilterFunctions gains Prev Next SPT_HELP-> SPTFunctionsByCategory Mathematical Functions Data Manipulation Functions SignalGeneratorMain AnalogFilterFunctions FIR Filter Design Window Functions IIR Filter Design FourierFunctions Plotting Functions Histogram Functions AnalogFilterFunctions-> fnbut fncheb1 fncheb2 fnbes fn2clp fn2chp fn2cbp fn2cbs fnbpole fnc1pole polbes gains makealog gains Headings-> Description Example

Complex Gain of a Laplace Transfer Function
 Syntax `y = gains(`b,a`)` Syntax `y = gains(`b,a,f`)` Include: `include spt\gains.oms` See Also gainz
``` ARGUMENTS:    INPUTS:        b = VECTOR, COLUMN. Numerator polynomial as column vector of            real-valued term coefficients. I.e.,            b => b(1) + b(2)*s + b(3)*s^2 + ..., s = jw = j2*PI*f            Any numerical type. Coerced to DOUBLE for local processing.        a = VECTOR, COLUMN. Denominator polynomial as column vector of            real-valued term coefficients. I.e.,            a => a(1) + a(2)*s + a(3)*s^2 + ...            Any numerical type. Coerced to DOUBLE for local processing.        f = MATRIX. Frequencies for evaluation [Hz]. Any numerical type.            Coerced to DOUBLE for local processing. If missing, transfer            function is evaluated at f=0 Hz only.    RETURN: MATRIX, COMPLEX. (b/a)(f), same dimension as 'f', type COMPLEX.            If 'f' is missing, return (b/a)(0), type DOUBLE. ```
Description ``` ```Returns the complex gain of a Laplace transfer function H(s) = b(s)/a(s) evaluated at frequencies in matrix 'f'. ``` ```This function returns a matrix of the same dimensions as input 'f' whose elements are the evaluation of H(s) = b(s)/a(s) at real frequencies 'f', where 'f' is in [Hz]. The input polynomials 'b' and 'a' are column vectors representing polynomials as follows: ``` ```b -> b(1) + b(2)*s + b(3)*s^2 + ..., ``` ```where s = j*2*PI*f, (j = sqrt(-1). ``` ```If argument 'f' is left off, then the DC gain at f=0 is returned.

Example
Make an analog 3rd Order Butterworth filter and find its complex gain at three frequencies. ``` include spt\gains.oms        # include gains() function b = novalue;                 # Declare numerator polynomial a = novalue;                 # Declare denominator polynomial fnbut(3,b,a);                # Make an order = 3 Butterworth function f = {1d-1, 1d0, 1d1}/2d0/PI; # Make a frequency evaluation vectorvector H = gains(b,a,f);            # Find the complex gain format complex "f10.6" H                            # Print the gain results ``` The results are: ``` { (  0.979999, -0.199000) ( -0.500000, -0.500000) ( -0.000199,  0.000980) } ```