# Design of dynamic behavior¶

SLiCAP has a number of built-in scripts to support circuit designers with the analysis and design of the dynamic behavior of electronic circuits. Brief descriptions of the implemented functions have been listed below.

## Obtain the coefficients of a Laplace polynomial¶

The function `getCoeffs.m`

rewrites the a symbolic expression as a polynomial of the Laplace variable `sym('s')`

and returns a MuPAD® list with the coefficients of this polynomial in ascending order. The function argument should be obtained from the execution of an instruction with the data type set to `'NUMER'`

or `'DENOM'`

.

```
syms('a_0', 'a_1', 'a_2', 'a_4', 's');
coeffs = getCoeffs(a_0 + a_1*s + a_2*s^2 + a_4*s^4);
```

The variable coeffs in the above example is the MuPAD list: `[a_0, a_1, a_2, 0, a_4]`

## Obtain the coefficients of a Laplace rational¶

The function `coeffsTransfer.m`

rewrites a rational function as the ratio of two polynomials of the Laplace variable `sym('s')`

and returns a MuPAD list comprising a list of coefficients of the numerator and a list of coefficients of the denominator. The coefficients have been normalized to obtain unity for the coefficient of the lowest order of the denominator. Both lists carry the coefficients in ascending order. The function argument should be obtained from the execution of an instruction with the data type set to `'LAPLACE'`

.

```
syms('b_0', 'b_2', 'a_0', 'a_1', 'a_2', 'a_4', 's');
rationalExpr = (b_0 + b_2*s^2)/(a_0 + a_1*s + a_2*s^2 + a_4*s^4);
coeffs = coeffsTransfer(rationalExpr);
```

The variable coeffs in the above example is the MuPAD list: `[[b_0/a_0, 0, b_2/a_0], [1, a_1/a_0, a_2/a_0, 0, a_4/a_0]]`

.

## Determine circuit parameters from a prototype transfer¶

The function `equateCoeffs.m`

can be used to find values of circuit elements such that the dynamic transfer of a circuit equals that of a prototype and is particularly useful for the design of passive and active filters. In the example below, the function expresses the parameters in `'polyCircuit'`

in those of `'polyProto'`

. This is done by equating the coefficients of the numerator and of the dominator of both transfer functions. In case of a solution, the function returns a MuPAD list with assignments for the symbolic variables found in ‘circuitTransferFunction’. If no solution is found, the function returns the MuPAD® boolean FALSE.

```
syms('s', 'R_1', 'R_2');
polyProto = 0.3*(1/(1+s*0.6));
% This could be a Laplace expression generated by SLiCAP:
polyCircuit = R_1/(R_1 + R_2)/(1 + s*R_1*R_2/(R_1 + R_2)*10e-6);
circuitComponentValues = equateCoeffs(polyProto, polyCircuit)
```

The variable `'circuitComponentValues'`

is the MuPAD list with equations: `[R_1 == 600000/7, R_2 == 200000]`

## Estimate the bandwith and system order of a negative-feedback circuit¶

The function `findServoBandwidth`

strongly facilitates the design of the dynamic behavior of negative feedback amplifiers.

With the loop gain reference variable properly selected, the dynamic behavior of a negative feedback amplifier is the product its ideal gain and the servo function. The servo function is determined by the loop gain. If the loop gain reaches infinity, the servo fuction approaches unity. The bandwidth of the servo functions is a measure for the frequency range over which the gain of a negative feedback system approaches its ideal gain.

The function `findServoBandwidth`

determines the unity gain frequencies of the asymptotes of the magnitude characteristic of the loop gain. It assumes a single passband low-pass, band-pass or high-pass behavior of the servo function. This means that there are maximally two unity gain frequencies of the loop gain. It calculates the frequencies of intersection of the asymptoties of the magnitude characteristic of the loop gain and unity, and the dominant order at these frequencies, in [Hz]. It also returns the maximum asymptotic value of the magnitude of the loop gain and its first frequency of occurence.

The function argument can be obtained from the execution of an instruction with the data type set to `'LAPLACE'`

and its gain type set to `'LOOPGAIN'`

.

```
syms 's'
loopGainNumer = -s*(1 + s/20)*(1 + s/40)/2;
loopGainDenom = (s + 1)^2*(1 + s/4e3)*(1 + s/50e3)*(1 + s/1e6);
loopGain = loopGainNumer/loopGainDenom;
servoInfo = findServoBandwidth(loopGain);
highPassFreq = servoInfo.hpf; % unity-gain frequency at rising slope
highPassOrder = servoInfo.hpo; % order of rising slope at servoInfo.hpf
lowPassFreq = servoInfo.lpf; % unity-gain frequency at falling slope
lowPassOrder = servoInfo.lpo; % order of rising slope at servoInfo.hpf
midBandValue = servoInfo.mbv; % largest value of loopGain asymptotes
% between servoInfo.hpf and servoInfo.lpf
midBandFreq = servoInfo.mbf; % first frequency of occurence of servoInfo.mbv
```

The results of the above script are:

```
highPassFreq = 254.65
highpassOrder = -1
lowPassFreq = 19894.4
lowPassOrder = +1
midBandValue = -2.5
midBandFreq = 636.62
```

Hence, the servo function can be realized with a first-order low-frequency cut-off at about 1.6krad/s (254.65 Hz) and a first-order high-frequency cut-off at about 125krad/s (19.8944 kHz) , and a mid-band loop gain of -2.5 at 4000rad/s (636.62Hz]. The result for this situation has been shown below.

If no low-frequency cut-off can be found, the high-pass cut-off frequency reads the MuPAD® boolean FALSE. If no high-frequency cut-off can be found, the low-pass cut-off frequency reads the MuPAD® variable infinity.

## Calculate the Routh array¶

The function `routh.m`

returns the Routh array of a Laplace polynomial. It requires the coefficients of a Laplace polynomial in ascending order as argument. These coefficients can be obtained from a Laplace expression that can be written as a Laplace polynomial with the function `coeffsTransfer.m`

.

```
syms 's' 'T'
LaplaceExpr = (1+s*T)^2*(1 + s/10 + s^2);
polyCoeffs = getCoeffs(LaplaceExpr);
RouthArray = routh(polyCoeffs);
```

The variable RouthArray becomes:

```
>> RouthArray
RouthArray =
[ T^2, T^2 + T/5 + 1, 1]
[ T^2/10 + 2*T, 2*T + 1/10, 0]
[ (5*T^3 + T^2 + 20*T + 100)/(5*(T + 20)), 1, 0]
[ (10*T^2 + T + 10)^2/(10*(5*T^3 + T^2 + 20*T + 100)), 0, 0]
[ 1, 0, 0]
```