# CH13. Filters and Oscillators
:::info
**Disclaimer**
If you spot any error, please contact me via my email: bigbeeismusic@gmail.com
:::
## 13.1 Basic Filter Concepts
### 13.1.1 Filter Transmission

Transfer function: $T(s)\equiv\frac{V_o(s)}{V_i(s)}=|T(j\omega)e^{j\phi(\omega)}|$
Gain function (magnitude of transmission): $G(\omega)\equiv 20\log|T(j\omega)|, \text{dB}$
Attenuation function: $A(\omega)=-20\log|T(j\omega)|, \text{dB}$
$\Rightarrow|V_o(j\omega)|=|T(j\omega)||V_i(j\omega)|$
### 13.1.2 Filter Types

### 13.1.3 Filter Specification

1. $\omega_p$: passband edge
2. $A_{\text{max}}$: maximum allowed variation in passband transmission ($0.05\sim3\text{dB}$)
3. $\omega_s$: stopband edge
4. $A_{\text{min}}$: minimum required stop attenuation ($20\sim100\text{dB}$)
### 13.1.4 Obtaining the Filter Transfer Function: Filter Approximation
:::warning
++Def++. (**Filter approximation**): The process of obtaining a transfer function that meets given specifications.
:::
### 13.1.5 Obtaining the Filter Circuit: Filter Realization
:::warning
++Def++. (**Filter realization**): The process of finding a circuit whose transfer function is equal to the given transfer function.
:::
- Passive filters: filters that only use inductors, capacitors, and resistors. **(work well at high frequency, but poor low-frequency performance because of inductors)**
- Active filters:
- Inductorless filters: replacing each inductance in the LCR filter with a circuit composed of op amps, resistors, and a capacitor, and having an input impedance equal to $sL$ (simulate the inductance).
- More on these later.
## 13.2 The Filter Transfer Function
$T(s)=\frac{a_Ms^M+a_{M-1}s^{M-1}+\cdots+a_0}{s^N+b_{N-1}s^{N-1}+\cdots+b_0}=a_M\frac{(s-z_1)(s-z_2)\cdots(s-z_M)}{(s-p_1)(s-p_2)\cdots(s-p_N)}$
### 13.2.1 The Filter Order
$N$ (degree of the denominator, also equal to the number of transmission zeros if includes $s=\infty$ and $z_1$, $z_2$...$z_M$).
### 13.2.2 The Filter Poles
:::success
++Recall++. For the amplifier to be stable, **all poles should be in the left half of the s plane** $\Rightarrow$ either lie on the negative real axis or occur in complex-conjugate pairs.
:::
:::info
++Note++. To obtain highly selective (sharp) responses, the poles are usually complex-conjugate except for one real pole if the filter order $N$ is odd.
:::
### 13.2.3 The Filter Transmission Zeros
high-pass $\Rightarrow s=0$ / low-pass $\Rightarrow s=\infty$
:::info
++Note++. Examples:
$T(s)=\frac{a_4(s^2+\omega_{l1}^2)(s^2+\omega_{l2}^2)}{s^5+b_4s^4+b_3s^3+b_2s^2+b_1s+b_0}$

$T(s)=\frac{a_5s(s^2+\omega_{l1}^2)(s^2+\omega_{l2}^2)}{s^6+b_5s^5+b_4s^4+b_3s^3+b_2s^2+b_1s+b_0}$

:::
### 13.2.4 All-Pole Filters
$T(s)=\frac{a_0}{s^N+b_{N-1}s^{N-1}+\cdots+b_0}$

### 13.2.5 Factoring $T(s)$ into the Product of First-Order and Second-Order Functions
$T(s)=\frac{k_1}{s+p_1}\times\frac{k_2s}{s^2+b_{11}s+b_{01}}\times\frac{k_3(s^2+\omega_{l}^2)}{s^2+b_{12}s+b_{02}}\times\cdots$
### 13.2.6 First-Order Filters
$T(s)=\frac{a_1s+a_0}{s+\omega_0}$
:::info
++Observation++.
one pole: $s=-\omega_0$ / one transmission zero $s=-\frac{a_0}{a_1}$
:::
### 13.2.7 Second-Order Filter Functions
$T(s)=\frac{a_2s^2+a_1s+a_0}{s^2+s(\frac{\omega_0}{Q})+\omega_0^2}$
:::info
++Observation++.
two pole: $p_1, p_2=-\frac{\omega_0}{2Q}\pm j\omega_0\sqrt{1-\frac{1}{4Q^2}}$

($\omega_0$ is known as the **pole frequency**, $Q$ is called the **pole quality factor**.)
:::
$a_0, a_1, a_2$ determine the type of the filter, for instance
#### Low-Pass
$T(s)=\frac{a_0}{s^2+s(\frac{\omega_0}{Q})+\omega_0^2}$

#### Bandpass
$T(s)=\frac{a_1s}{s^2+s(\frac{\omega_0}{Q})+\omega_0^2}$

#### Notch
$T(s)=a_2\frac{s^2+\omega_n^2}{s^2+s(\frac{\omega_0}{Q})+\omega_0^2}$

:::info
++Note++. The figure shown above is the case where $\omega_n>\omega_0$ (**low-pass notch (LPN)**)
:::
## 13.3 Butterworth and Chebyshev Filters
### 13.3.1 The Butterworth Filter

$|T(j\omega)|=\frac{1}{\sqrt{1+\epsilon^2\left(\frac{\omega}{\omega_p}\right)^N}}\Rightarrow |T(j\omega_p)|=\frac{1}{\sqrt{1+\epsilon^2}}$
Maximum variation in passband transmission: $A_{\text{max}}=20\log\sqrt{1+\epsilon^2}$ (Or, $\epsilon=\sqrt{10^{A_{\text{max}}/10}-1}$)
:::info
++Observation++. Magnitude response for Butterworth filters of various order ($\epsilon=1$)

We can determine the level of the filter according to the $A_{\text{min}}$. (Note that $A(\omega_s)=10\log[1+\epsilon^2(\omega_s/\omega_p)^{2N}]$)
:::
**The poles of an $N$th-order Butterworth filter**

$\Rightarrow$ pole frequency $\omega_0=\omega_p(1/\epsilon)^{1/N}$
$\Rightarrow Q_k=1/\left[2\sin\left(\frac{2k-1}{N}\frac{\pi}{2}\right)\right], k=1,2,\dots\frac{N-1}{2}$ (or $\frac{N}{2}$)
$\Rightarrow T(s)=\frac{K\omega_0^N}{(s+\omega_0)\prod_{k=1}^{(N-1)/2}\left(s^2+s\frac{\omega_0}{Q_k}+\omega_0^2\right)}$ (or $\frac{K\omega_0^N}{\prod_{k=1}^{N/2}\left(s^2+s\frac{\omega_0}{Q_k}+\omega_0^2\right)}$)
### 13.3.2 The Chebyshev Filter

$|T(j\omega)| =
\begin{cases}
\frac{1}{\sqrt{1+\epsilon^2\cos^2[N\cos^{-1}(\omega/\omega_p)]}}, \text{if }\omega\leq\omega_p\\
\frac{1}{\sqrt{1+\epsilon^2\cosh^2[N\cosh^{-1}(\omega/\omega_p)]}}, \text{if }\omega\geq\omega_p\\
\end{cases}\Rightarrow|T(j\omega_p)|=\frac{1}{\sqrt{1+\epsilon^2}}$
$\Rightarrow A_{\text{max}}=10\log(1+\epsilon^2)$ (Or, $\epsilon=\sqrt{10^{A_{\text{max}}/10}-1}$)
:::info
++Observation++. We can determine the level of the filter according to the $A_{\text{min}}$. (Note that $A(\omega_s)=10\log[1+\epsilon^2\cosh^2(N\cosh^{-1}(\omega_s/\omega_p))]$)
:::
$\Rightarrow p_k=-\omega_p\sin\left(\frac{2k-1}{N}\frac{\pi}{2}\right)\sinh\left(\frac{1}{N}\sinh^{-1}\frac{1}{\epsilon}\right)+j\omega_p\cos\left(\frac{2k-1}{N}\frac{\pi}{2}\right)\cosh\left(\frac{1}{N}\sinh^{-1}\frac{1}{\epsilon}\right)$
$\Rightarrow T(s)=\frac{K\omega_p^N}{\epsilon 2^{N-1}(s-p_1)(s-p_2)\cdots(s-p_N)}$
## 13.4 Second-Order Passive Filters Based on the LCR Resonator

### 13.4.1 The Resonator Poles

$\Rightarrow\frac{V_o}{I}=\frac{1}{Y}=\frac{1}{(1/sL)+sC+(1/R)}=\frac{s/C}{s^2+s(1/CR)+(1/LC)}$
$\Rightarrow \omega_0=\frac{1}{\sqrt{LC}}$, $Q=\omega_0CR=R\sqrt{\frac{C}{L}}$
:::info
++Note++. Alternative method to obtain the resonator poles:

:::
### 13.4.2 Realization of Transmission Zeros

$T(s)=\frac{V_o(s)}{V_i(s)}=\frac{Z_2(s)}{Z_1(s)+Z_2(s)}=\frac{Y_1(s)}{Y_1(s)+Y_2(s)}$
### 13.4.3 Realization of the Low-Pass Function

$T(s)=\frac{1/sL}{(1/sL)+sC+(1/R)}=\frac{1/LC}{s^2+s(1/CR)+(1/LC)}$
### 13.4.4 Realization of the Bandpass Function

$T(s)=\frac{1/R}{(1/sL)+sC+(1/R)}=\frac{s(1/CR)}{s^2+s(1/CR)+(1/LC)}$
### 13.4.5 Realization of the Notch Functions

$T(s)=a_2\frac{s^2+\omega_0^2}{s^2+s(\omega_0/Q)+\omega_0^2}=\frac{s^2+(1/LC)}{s^2+s(1/CR)+(1/LC)}$
:::info
++Note++. General notch filter:

$L_1C_1=1/\omega_n^2$ (create a transmission zero)
$C_1+C_2=C$, $L_1||L_2=L$
$\Rightarrow$ as $s\to0$:

$\Rightarrow$ as $s\to\infty$:

:::
## 13.5 Second-Order Active Filters Based on Inductance Simulation
### 13.5.1 The Antoniou Inductance-Simulation Circuit

$\Rightarrow Z_{in}\equiv\frac{V_1}{I_1}=s\frac{C_4R_1R_3R_5}{R_2}\Rightarrow L=\frac{C_4R_1R_3R_5}{R_2}$
:::info
++Note++. Analysis & Derivation

:::
### 13.5.2 The Op Amp-RC Resonator

($L$ is the simulated inductance realized by the Antoniou circuit)
$\Rightarrow\omega_0=1/\sqrt{LC_6}=1/\sqrt{C_4C_6R_1R_3R_5/R_2}$, $Q=\omega_0C_6R_6=R_6\sqrt{\frac{C_6}{C_4}\frac{R_2}{R_1R_3R_5}}$
:::info
++Note++. Usually we select $C_4=C_6=C$, $R_1=R_2=R_3=R_5=R$, and thus
$\omega_0=1/CR$, $Q=R_6/R$
:::
### 13.5.3 Realization of the Various Filter Types

:::info
++Note++. Implementation of buffer amp $K$:

:::
**Low-pass filter**

**Band-pass filter**

**Notch filter**

($C_{61}+C_{62}=C$, $R_{51}||R_{52}=R$)
$\omega_n=\frac{1}{\sqrt{C_{61}C_4R_1R_3R_{51}/R_2}}$
## 13.6 Second-Order Active Filters Based on the Two-Integrator Loop
### 13.6.1 Derivation of the Two-Integrator-Loop Biquad
:::success
++Recall++. Integrator in time domain: $y(t)=\int_{-\infty}^t x(\tau)d\tau$, in s-domain: $Y(s)=\frac{X(s)}{s}\Rightarrow H(s)=\frac{1}{s}$.
:::
Consider $\frac{V_{hp}}{V_i}=\frac{Ks^2}{s^2+s(\omega_0/Q)+\omega_0^2}\Rightarrow V_{hp}+\frac{1}{Q}\left(\frac{\omega_0}{s}V_{hp}\right)+\left(\frac{\omega_0^2}{s^2}V_{hp}\right)=KV_i$

:::info
++Observation++.
The output of the first integrator:
$T_{bp}(s)=\frac{(-\omega_0/s)V_{hp}}{V_i}=-\frac{K\omega_0s}{s^2+s(\omega_0/Q)+\omega_0^2}\Rightarrow$ **band-pass**
The output of the second integrator:
$T_{lp}(s)=\frac{(\omega_0^2/s^2)V_{hp}}{V_i}=\frac{K\omega_0^2}{s^2+s(\omega_0/Q)+\omega_0^2}\Rightarrow$ **low-pass**
Notice that this circuit achieve HP, BP and LP functions simultaneously $\Rightarrow$ universal active filter.
:::
### 13.6.2 Circuit Implementation
:::success
++Recall++. Operation amplifiers applications:
- Inverting configuration:

$G=\frac{v_O}{v_I}=\frac{-R_2/R_1}{1+(1+R_2/R_1)/A}\simeq-\frac{R_2}{R_1}$
- Weighted summer:

$v_O=v_1(\frac{R_a}{R_1})(\frac{R_c}{R_b})+v_2(\frac{R_a}{R_2})(\frac{R_c}{R_b})-v_3(\frac{R_c}{R_3})-v_4(\frac{R_c}{R_4})$
- Integrator:

$\frac{V_o}{V_i}=-\frac{1}{sCR}$
:::
**KHN biquad**

View $V_i$, $V_{bp}$ and $V_{lp}$ as input and using superposition, we have
$V_{hp}=V_i\frac{R_3}{R_2+R_3}\left(1+\frac{R_f}{R_1}\right)+V_{bp}\frac{R_2}{R_2+R_3}\left(1+\frac{R_f}{R_1}\right)-V_{lp}\frac{R_f}{R_1}$
Since $V_{bp}\equiv-\frac{\omega_0}{s}V_{hp}$, $V_{lp}\equiv\frac{\omega_0^2}{s^2}V_{hp}$,
$V_{hp}=V_i\frac{R_3}{R_2+R_3}\left(1+\frac{R_f}{R_1}\right)+\frac{R_2}{R_2+R_3}\left(1+\frac{R_f}{R_1}\right)\left(-\frac{\omega_0}{s}V_{hp}\right)-\frac{R_f}{R_1}\left(\frac{\omega_0^2}{s^2}V_{hp}\right)$
Comparing the equation with $V_{hp}+\frac{1}{Q}\left(\frac{\omega_0}{s}V_{hp}\right)+\left(\frac{\omega_0^2}{s^2}V_{hp}\right)=KV_i$, we have
$\frac{R_f}{R_1}=1$, $\frac{R_3}{R_2}=2Q-1$, $K=2-\frac{1}{Q}$
:::info
++Note++. To implement notch filters, use and extra summer:

:::
### 13.6.3 An Alternative Two-Integrator-Loop Biquad Circuit

**Tow Thomas biquad** - do summation of the current at the input of first integrator

$\Rightarrow\omega_0=\frac{1}{CR}$
:::info
++Note++. To implement notch filters, instead of use an extra op amp as the summer, consider the Tow-Thomas biquad with feedforward:

$\frac{V_o}{V_i}=-\frac{s^2\left(\frac{C_1}{C}\right)+s\frac{1}{C}\left(\frac{1}{R_1}-\frac{r}{RR_3}\right)+\frac{1}{C^2RR_2}}{s^2+s\frac{1}{QCR}+\frac{1}{C^2R^2}}$
For example, $R_1=R_3=\infty$ yields $\frac{V_o}{V_i}=-\frac{s^2\left(\frac{C_1}{C}\right)+\frac{1}{C^2RR_2}}{s^2+s\frac{1}{QCR}+\frac{1}{C^2R^2}}$
:::
## 13.7 Second-Order Active Filters Using a Single Op Amp
### 13.7.1 Bandpass Circuit

:::info
++Note++. Analysis & Derivation

:::
$\frac{V_o}{R_3}+sC_1\left(V_o+\frac{1}{C_2R_3}V_o\right)+\frac{1}{R_4}\left(V_i+\frac{1}{sC_2R_3}V_o\right)=0$
$\Rightarrow T(s)=-\frac{s\frac{1}{C_1R_4}}{s^2+s\frac{1}{R_3}\left(\frac{1}{C_1}+\frac{1}{C_2}\right)+\frac{1}{C_1C_2R_3R_4}}$
Compare with $T(s)=\frac{sK(\omega_0/Q)}{s^2+s(\omega_0/Q)+\omega_0^2}$, we get
$\omega_0=\frac{1}{\sqrt{C_1C_2R_3R_4}}$, $Q=\frac{1}{\sqrt{C_1C_2R_3R_4}}/\left[\frac{1}{R_3}\left(\frac{1}{C_1}+\frac{1}{C_2}\right)\right]$, $K=-\frac{R_3}{R_4}\left(1+\frac{C_1}{C_2}\right)$
:::info
++Note++. Usually we select $C_1=C_2=C$, $R_3=R$, $R_4=R/m$ ($m=4Q^2$), and thus
$\omega_0=2Q/CR$, $K=-2Q^2$
:::
### 13.7.2 High-Pass Circuit

:::info
++Note++. Analysis & Derivation

:::
$\Rightarrow T(s)=\frac{s^2}{s^2+s\frac{1}{R_3}\left(\frac{1}{C_1}+\frac{1}{C_2}\right)+\frac{1}{C_1C_2R_3R_4}}$
Compare with $T(s)=\frac{Ks^2}{s^2+s(\omega_0/Q)+\omega_0^2}$, we get
$\omega_0=\frac{1}{\sqrt{C_1C_2R_3R_4}}$, $Q=\frac{1}{\sqrt{C_1C_2R_3R_4}}/\left[\frac{1}{R_3}\left(\frac{1}{C_1}+\frac{1}{C_2}\right)\right]$, $K=1$
:::info
++Note++. Above two circuits are related to rach other through the **complementary transformation**, thus they have same poles.
:::
### 13.7.3 Low-Pass Circuit

$\Rightarrow T(s)=\frac{1/C_3C_4R_1R_2}{s^2+s\frac{1}{C_4}\left(\frac{1}{R_1}+\frac{1}{R_2}\right)+\frac{1}{C_3C_4R_1R_2}}$
Compare with $T(s)=\frac{K\omega_0^2}{s^2+s(\omega_0/Q)+\omega_0^2}$, we get
$\omega_0=\frac{1}{\sqrt{C_3C_4R_1R_2}}$, $Q=\frac{1}{\sqrt{C_3C_4R_1R_2}}/\left[\frac{1}{C_4}\left(\frac{1}{R_1}+\frac{1}{R_2}\right)\right]$, $K=1$
:::info
++Note++. Usually we select $R_1=R_2=R$, $C_3=C$, $C_4=C/4Q^2$, and thus
$\omega_0=2Q/CR$
:::
## 13.8 Switched-Capacitor Filters
### 13.8.1 The Basic Principle

**Two-phase clock (nonoverlapping)**

(Assume the the clock frequency $f_c=1/T_c$ is much higher than the frequency of the input signal $v_i$)
During $\phi_1$: $q_{C1}=C_1v_i$
During $\phi_2$: $i_{\text{av}}=\frac{C_1v_i}{T_c}\Rightarrow R_{eq}\equiv\frac{v_i}{i_{\text{av}}}=\frac{T_c}{C_1}$
$\Rightarrow\text{Time constant}=C_2R_{eq}=T_c\frac{C_2}{C_1}$
### 13.8.2 Switch-Capacitor Integrator
**Noninverting**

**Inverting**

### 13.8.3 Switched-Capacitor Biquad Filter

((a): original version; (b) switch-capacitor version)
$\Rightarrow\omega_0=\frac{1}{\sqrt{C_1C_2R_{3eq}R_{4eq}}}=\frac{1}{T_c}\sqrt{\frac{C_3}{C_2}\frac{C_4}{C_1}}$, $Q=\frac{R_{5eq}}{R_{4eq}}=\frac{T_c/C_5}{T_c/C_4}=\frac{C_4}{C_5}$
:::info
++Note++. Usually we select $C_1=C_2=C$, $\frac{T_c}{C_3}C_2=\frac{T_c}{C_4}C_1$, $C_5=\frac{C_4}{Q}$ (and thus $C_3=C_4=(\omega_0T_c)C$)
$\Rightarrow\text{Center-frequency gain}=QK=\frac{R_{5eq}}{R_{6eq}}=\frac{C_6}{C_5}$
:::
## 13.9 Basic Principles of Sinusoidal Oscillators
### 13.9.1 The Oscillator Feedback Loop

(positive-feedback loop)
$A_f(s)=\frac{A(s)}{1-A(s)\beta(s)}$, Loop gain $L(s)\equiv A(s)\beta(s)$
Characteristic equation: $1-L(s)=0$
### 13.9.2 The Oscillaton Criterion
:::warning
++Def++. (**Barkhausen criterion**): $L(j\omega_0)\equiv A(j\omega_0)\beta(j\omega_0)=1$
:::
:::info
++Note++. For the circuit to produce sustained oscillations at $\omega_0$, the characteristic equation must have roots at $s=\pm j\omega_0\Rightarrow 1-A(s)\beta(s)$ must have a factor of the form $s^2+\omega_0^2$.
:::
### 13.9.3 Analysis of Oscillator Circuits
1. Break the feedback loop to find $A(s)\beta(s)$.
2. Find $\omega_0$ (frequency where $\phi(\omega_0)=0$ of $360^\circ$).
3. Find the condition for the oscillations to start: $|A(j\omega_0)\beta(j\omega_0)|\geq 1$.
#### An Alternative Analysis Approach
Assume the the signal is oscillating with frequency $\omega_0\Rightarrow$ obtain the function of $s$ ($D(s)=0$) $\Rightarrow$ Substitute using $s=j\omega_0$ and solve.
### 13.9.4 Nonlinear Amplitude Control

When the output signal is small: $R_f=R_2+R_3$
When the output signal is large: $D_1$ or $D_2$ will conduct $\Rightarrow R_f\searrow$
:::info
++Note++. Alternative approach using the limiter:

($\frac{4}{\pi}$ is derived from the fourier series of the square wave, we assume that the RLC filter is very selective.)
:::
## 13.10 Op Amp-RC Oscillator Circuits
### 13.10.1 The Wien-Bridge Oscillator

$L(s)=\left(1+\frac{R_2}{R_1}\right)\frac{Z_p}{Z_p+Z_s}=\frac{1+R_2/R_1}{1+Z_sY_p}=\frac{1+R_2/R_1}{3+sCR+1/sCR}$
$\Rightarrow L(j\omega)=\frac{1+R_2/R_1}{3+j(\omega CR-1/\omega CR)}\Rightarrow\omega_0=\frac{1}{CR}$
$\Rightarrow$ oscillations will start when $\frac{R_2}{R_1}\geq 2$
**Wien-bridge oscillator with a limiter**

:::info
++Observation++.
The positive peak happens when $v_b$ exceeds $v_1$ ($\simeq\frac{1}{3}v_O$) and thus $D_2$ conducts, while the negative peak happens when $D_1$ conducts. Also, we neglect the current through the diode when the peak is just reached.
:::
($V_{D1}=V_{D2}=V_D$)
$\hat{v}_{O+}=\left[\left(\frac{R_5}{R_6}\right)V_{SS}+\left(1+\frac{R_5}{R_6}\right)V_D\right]/\left(\frac{2}{3}-\frac{1}{3}\frac{R_5}{R_6}\right)$
$\hat{v}_{O-}=-\left[\left(\frac{R_4}{R_3}\right)V_{DD}+\left(1+\frac{R_4}{R_3}\right)V_D\right]/\left(\frac{2}{3}-\frac{1}{3}\frac{R_4}{R_3}\right)$
To obtain a symmetrical output, select $R_3=R_6$, $R_4=R_5$, $V_{SS}=V_{DD}$
:::info
++Note++.
- $v_I$ will have less distortion than $v_O$.
- The node at $v_I$ has a high-impedance (not desired).
:::
**Wien-bridge oscillator with the resistance-variation mechanism**

:::info
++Note++.
- Signal at $b$ has lower distortion than that in $a$.
- However, node $b$ has high-impedance.
:::
### 13.10.2 The Phase-Shift Oscillator

:::info
++Observation++. The phase shift at the RC ladder network should be $180^{\circ}$ for the oscillation to happen.
:::
**Phase-shift oscillator with a feedback limiter**

$\Rightarrow A(j\omega)\beta(j\omega)=\frac{\omega^2C^2RR_f}{4+j(3\omega CR-1/\omega CR)}$
### 13.10.3 The Quadrature Oscillator

:::info
++Observation++. Equivalent circuit at the input of op amp 2

$v=\frac{v_{O2}}{2}\Rightarrow i_{R_f}=-\frac{v}{R_f}$
Set $R_f=2R\Rightarrow v=\frac{1}{C}\int_0^t\frac{v_{O1}}{2R}dt$, $v_{O2}=\frac{1}{CR}\int_0^tv_{O1}dt$
:::
Neglect the limiter, we have
$L(s)\equiv\frac{V_{o2}}{V_x}=-\frac{1}{s^2C^2R^2}=\frac{1}{\omega^2C^2R^2}\Rightarrow\omega_0=\frac{1}{CR}$
### 13.10.4 The Active-Filter-Tuned Oscillator
**Basic principle**

**Implementation**

:::info
++Observation++. In this circuit, the $R_2$ and $C_4$ of the Antoniou inductance-simulation circuit are interchanged $\Rightarrow$ makes
the output of the lower op amp twice as large as the voltage across the resonator.
:::
### 13.10.5 A Final Remark
:::info
++Note++. The op amp-RC oscillator circuits usually operate in the range of $10\text{Hz}\sim1\text{MHz}$. For higher frequencies, it is common to use circuits employing transistors with LC-tuned circuits or crystals.
:::
## 13.11 LC and Crystal Oscillators
### 13.11.1 The Colpitts and Hartely Oscillators

((a): Colpitts; (b): Hartley)
For the Colpitts oscillator, $\omega_0=1/\sqrt{L\left(\frac{C_1C_2}{C_1+C_2}\right)}$
For the Hartley oscillator, $\omega_0=1/\sqrt{(L_1+L_2)C}$
**More detail on the colpitts oscillator**

The voltage gain of the MOSFET: $A=g_mR\Rightarrow V_{ds}=AV_{sg}$
($R$: effective resistance between D&S, including $r_o$ and a resistance due to the inductor loss)
At $\omega=\omega_0$, we have $Z\to\infty$, $I=0$
$V_{sg}=sC_1V_{ds}\times\frac{1}{sC_2}=\frac{C_1}{C_2}V_{ds}\Rightarrow\beta=\frac{V_{sg}}{V_{ds}}=\frac{C_1}{C_2}$
$\Rightarrow A\beta=A\frac{C_1}{C_2}=(g_m R)\left(\frac{C_1}{C_2}\right)$
For oscillations to start: $(g_m R)\left(\frac{C_1}{C_2}\right)>1\Rightarrow g_mR>\frac{C_2}{C_1}$
(As for the Hartley oscillator, $g_mR>\frac{L_1}{L_2}$)
:::info
++Note++. Alternative analysis method: consider node D at figure (b),
$sC_2V_{gs}+g_mV_{gs}+\left(\frac{1}{R}+sC_1\right)(1+s^2LC_2)V_{gs}=0$
$\Rightarrow s^3LC_1C_2+s^2(LC_2/R)+s(C_1+C_2)+\left(g_m+\frac{1}{R}\right)=0$
$\Rightarrow\left(g_m+\frac{1}{R}-\frac{\omega^2LC_2}{R}\right)+j[\omega(C_1+C_2)-\omega^3LC_1C_2]=0$
Imaginary part: $\omega_0=1/\sqrt{L\left(\frac{C_1C_2}{C_1+C_2}\right)}$
Real part: $g_mR=C_2/C_1$
:::
### 13.11.2 The Cross-Coupled LC Oscillator

($\omega_0=1/\sqrt{LC}$, $R_p=\omega_0LQ$)
**Signal equivalent circuit**

Gain of each stage: $A_1=A_2=-g_m(R_p||r_o)$
Sustain oscillation $\Rightarrow |A_1A_2|=[g_m(R_p||r_o)]^2=1\Rightarrow g_m(R_p||r_o)=1$
### 13.11.3 Crystal Oscillators
**Symbol and equivalent circuit**

(Large $L$, very small $C_s$ ($C_p\gg C_s$), very high $Q\Rightarrow r$ can be neglected)
$Z(s)=1/\left[sC_p+\frac{1}{sL+1/sC_s}\right]=\frac{1}{sC_p}\frac{s^2+(1/LC_s)}{s^2+[(C_p+C_s)/LC_sC_p]}$
$\Rightarrow Z(j\omega)=-j\frac{1}{\omega C_p}\left(\frac{\omega^2-\omega_s^2}{\omega^2-\omega_p^2}\right)$
where $\omega_s=\frac{1}{\sqrt{LC_s}}$, $\omega_p=1/\sqrt{L\left(\frac{C_sC_p}{C_s+C_p}\right)}$

:::info
++Observation++. The crystal reactance is inductive within $\omega_s\sim\omega_p\Rightarrow$ can be use as an inductor of the Colpitts oscillator, and
$\omega_0\simeq1/\sqrt{LC_s}=\omega_s$
:::
**Pierce oscillator** (based on the Colpitts oscillator with CMOS inverter, which will be discussed in Chapter 14)

($R_1C_1$: low-pass filter)
## 13.12 Nonlinear Oscillators or Function Generators
### 13.12.1 The Bistable Feedback Loop

($\beta=\frac{R_1}{R_1+R_2}$)
Two possible outcomes (stable states):
- Positive saturation: $v_O=L_+$, $v_+=L_+\frac{R_1}{R_1+R_2}$
- Negative saturation: $v_O=L_-$, $v_+=L_-\frac{R_1}{R_1+R_2}$
:::info
++Note++. Although $v_O=v_+=0$ is theoretical feasible, it is unstable (i.e., it is in the metastable state).
:::
### 13.12.2 Transfer Characteristic of the Bistable Circuit


($V_{TH}=\beta L_+$, $V_{TL}=\beta L_-$)
### 13.12.3 Triggering the Bistable Circuit
From $L_+$ to $L_-$: apply $v_I>V_{TH}$
From $L_-$ to $L_+$: apply $v_I<V_{TL}$
:::info
++Note++. $v_I$ only triggers regeneration and thus can be simply a pulse (or short-duration signal). Therefore, $v_I$ is referred to as a trigger signal (or simply a trigger).
:::
### 13.12.4 The Bistable Circuit as a Memory Element
When $V_{TL}<v_I<V_{TH}$, $v_O$ is depended on. the previous value of the trigger signal $\Rightarrow$ **the circuit exhibits memory**
:::info
++Note++. In analog-circuit applications, the bistable circuit is also known as a **Schmitt trigger**.
:::
### 13.12.5 A Bistable Circuit with Noninvertng Transfer Characteristic

(**Notice the +/- sign on the op amp**)
$v_+=v_I\frac{R_2}{R_1+R_2}+v_O\frac{R_1}{R_1+R_2}\Rightarrow V_{TL}=-L_+\frac{R_1}{R_2}$, $V_{TH}=-L_-\frac{R_1}{R_2}$
### 13.12.6 Generating Square Waveforms Using a Bistable Circuit
**Basic Principle**

**Circuit Implementation**

**Waveforms**

($\tau=CR$)
(When rising to $L_+$) $v_-=L_+-(L_+-\beta L_-)e^{-t/\tau}$
$v_-(T_1)=\beta L_+\Rightarrow T_1=\tau\ln\frac{1-\beta(L_-/L_+)}{1-\beta}$
(When falling to $L_-$) $v_-=L_--(L_--\beta L_+)e^{-t/\tau}$
$v_-(T_2)=\beta L_-\Rightarrow T_2=\tau\ln\frac{1-\beta(L_+/L_-)}{1-\beta}$
Given that $L_+=-L_-$, the wave period is
$T=T_1+T_2=2\tau\ln\frac{1+\beta}{1-\beta}$
### 13.12.7 Generating Triangular Waveforms

(Note that we use noninverting type bistable circuit, replace low-pass filter with an integrator)
**Waveforms**

$\frac{V_{TH}-V_{TL}}{T_1}=\frac{L_+}{CR}\Rightarrow T_1=CR\frac{V_{TH}-V_{TL}}{L_+}$
$\frac{V_{TH}-V_{TL}}{T_2}=\frac{-L_-}{CR}\Rightarrow T_2=CR\frac{V_{TH}-V_{TL}}{-L_-}$
## Summary
**Filters**
- The characteristics of a filter:
- $\omega_p$: passband edge.
- $A_{\text{max}}$: maximum allowed variation in passband transmission ($0.05\sim3\text{dB}$).
- $\omega_s$: stopband edge.
- $A_{\text{min}}$: minimum required stop attenuation ($20\sim100\text{dB}$).
- To obtain highly selective (sharp) responses, the poles are usually complex-conjugate except for one real pole if the filter order $N$ is odd.
- For Butterworth filters,
- $|T(j\omega)|=\frac{1}{\sqrt{1+\epsilon^2\left(\frac{\omega}{\omega_p}\right)^N}}\Rightarrow |T(j\omega_p)|=\frac{1}{\sqrt{1+\epsilon^2}}$.
- $A_{\text{max}}=20\log\sqrt{1+\epsilon^2}$.
- $A(\omega_s)=10\log[1+\epsilon^2(\omega_s/\omega_p)^{2N}]$.
- $\omega_0=\omega_p(1/\epsilon)^{1/N}$.
- $Q_k=1/\left[2\sin\left(\frac{2k-1}{N}\frac{\pi}{2}\right)\right], k=1,2,\dots\frac{N-1}{2}$ (or $\frac{N}{2}$).
- $T(s)=\frac{K\omega_0^N}{(s+\omega_0)\prod_{k=1}^{(N-1)/2}\left(s^2+s\frac{\omega_0}{Q_k}+\omega_0^2\right)}$ (or $\frac{K\omega_0^N}{\prod_{k=1}^{N/2}\left(s^2+s\frac{\omega_0}{Q_k}+\omega_0^2\right)}$).
- For Chebyshev Filters,
- $|T(j\omega)| =
\begin{cases}
\frac{1}{\sqrt{1+\epsilon^2\cos^2[N\cos^{-1}(\omega/\omega_p)]}}, \text{if }\omega\leq\omega_p\\
\frac{1}{\sqrt{1+\epsilon^2\cosh^2[N\cosh^{-1}(\omega/\omega_p)]}}, \text{if }\omega\geq\omega_p\\
\end{cases}\Rightarrow|T(j\omega_p)|=\frac{1}{\sqrt{1+\epsilon^2}}$.
- $A_{\text{max}}=10\log(1+\epsilon^2)$.
- $A(\omega_s)=10\log[1+\epsilon^2\cosh^2(N\cosh^{-1}(\omega_s/\omega_p))]$.
- $p_k=-\omega_p\sin\left(\frac{2k-1}{N}\frac{\pi}{2}\right)\sinh\left(\frac{1}{N}\sinh^{-1}\frac{1}{\epsilon}\right)+j\omega_p\cos\left(\frac{2k-1}{N}\frac{\pi}{2}\right)\cosh\left(\frac{1}{N}\sinh^{-1}\frac{1}{\epsilon}\right)$.
- $T(s)=\frac{K\omega_p^N}{\epsilon 2^{N-1}(s-p_1)(s-p_2)\cdots(s-p_N)}$.
- For second-order passive filters, $\omega_0=\frac{1}{\sqrt{LC}}$, $Q=\omega_0CR=R\sqrt{\frac{C}{L}}$.
- Replacing the inductor in the second-order passive filter with the **simulated inductance using the Antoniou circuit** ($L=\frac{C_4R_1R_3R_5}{R_2}$), we obtain an op amp-RC resonator.
- $\omega_0=\frac{1}{\sqrt{C_4C_6R_1R_3R_5/R_2}}=\frac{1}{CR}$.
- $Q=\omega_0C_6R_6=R_6\sqrt{\frac{C_6}{C_4}\frac{R_2}{R_1R_3R_5}}=\frac{R_6}{R}$.
- For KHN biquads,
- $T_{hp}(s)=\frac{Ks^2}{s^2+s(\omega_0/Q)+\omega_0^2}$, $T_{bp}(s)=\frac{(-\omega_0/s)V_{hp}}{V_i}=-\frac{K\omega_0s}{s^2+s(\omega_0/Q)+\omega_0^2}$, $T_{lp}(s)=\frac{(\omega_0^2/s^2)V_{hp}}{V_i}=\frac{K\omega_0^2}{s^2+s(\omega_0/Q)+\omega_0^2}$.
- $\frac{R_f}{R_1}=1$, $\frac{R_3}{R_2}=2Q-1$, $K=2-\frac{1}{Q}$.
- To implement notch filters, use and extra summer.
- For Tow Thomas biquads,
- We do summation of the current at the input of first integrator, therefore $V_{hp}$ can't be obtained directly.
- To implement notch filters, instead of use an extra op amp as the summer, consider the Tow-Thomas biquad with feedforward: $\frac{V_o}{V_i}=-\frac{s^2\left(\frac{C_1}{C}\right)+s\frac{1}{C}\left(\frac{1}{R_1}-\frac{r}{RR_3}\right)+\frac{1}{C^2RR_2}}{s^2+s\frac{1}{QCR}+\frac{1}{C^2R^2}}$.
- For single op amp bandpass circuits,
- $T(s)=-\frac{s\frac{1}{C_1R_4}}{s^2+s\frac{1}{R_3}\left(\frac{1}{C_1}+\frac{1}{C_2}\right)+\frac{1}{C_1C_2R_3R_4}}$.
- $\omega_0=\frac{1}{\sqrt{C_1C_2R_3R_4}}$, $Q=\frac{1}{\sqrt{C_1C_2R_3R_4}}/\left[\frac{1}{R_3}\left(\frac{1}{C_1}+\frac{1}{C_2}\right)\right]$, $K=-\frac{R_3}{R_4}\left(1+\frac{C_1}{C_2}\right)$.
- For single op amp high-pass circuits,
- $T(s)=\frac{s^2}{s^2+s\frac{1}{R_3}\left(\frac{1}{C_1}+\frac{1}{C_2}\right)+\frac{1}{C_1C_2R_3R_4}}$.
- $\omega_0=\frac{1}{\sqrt{C_1C_2R_3R_4}}$, $Q=\frac{1}{\sqrt{C_1C_2R_3R_4}}/\left[\frac{1}{R_3}\left(\frac{1}{C_1}+\frac{1}{C_2}\right)\right]$, $K=1$.
- For single op amp low-pass circuits,
- $T(s)=\frac{1/C_3C_4R_1R_2}{s^2+s\frac{1}{C_4}\left(\frac{1}{R_1}+\frac{1}{R_2}\right)+\frac{1}{C_3C_4R_1R_2}}$.
- $\omega_0=\frac{1}{\sqrt{C_3C_4R_1R_2}}$, $Q=\frac{1}{\sqrt{C_3C_4R_1R_2}}/\left[\frac{1}{C_4}\left(\frac{1}{R_1}+\frac{1}{R_2}\right)\right]$, $K=1$.
- In the switched-capacitor circuit, we use switches (periodically switch between two nodes is frequency $f_c$) and capacitors to simulate resistors ($R_{eq}=\frac{T_c}{C}=\frac{1}{Cf_c}$).
- For switched-capacitor biquads,
- $\omega_0=\frac{1}{\sqrt{C_1C_2R_{3eq}R_{4eq}}}=\frac{1}{T_c}\sqrt{\frac{C_3}{C_2}\frac{C_4}{C_1}}$, $Q=\frac{R_{5eq}}{R_{4eq}}=\frac{C_4}{C_5}$.
- $\text{Center-frequency gain}=QK=\frac{R_{5eq}}{R_{6eq}}=\frac{C_6}{C_5}$.
**Oscillators**
- Analysis of oscillator circuits:
- Break the feedback loop to find $A(s)\beta(s)$.
- Find $\omega_0$ (frequency where $\phi(\omega_0)=0$ of $360^\circ$).
- Find the condition for the oscillations to start: $|A(j\omega_0)\beta(j\omega_0)|\geq 1$.
- Nonlinear amplitude-control mechanism: activates when the loop gain is greater than unity.
- For Wein-Bridge oscillators,
- $L(j\omega)=\frac{1+R_2/R_1}{3+j(\omega CR-1/\omega CR)}$.
- $\omega_0=\frac{1}{CR}$.
- oscillations will start when $\frac{R_2}{R_1}\geq 2$.
- with the limiter added:
- $\hat{v}_{O+}=\left[\left(\frac{R_5}{R_6}\right)V_{SS}+\left(1+\frac{R_5}{R_6}\right)V_D\right]/\left(\frac{2}{3}-\frac{1}{3}\frac{R_5}{R_6}\right)$
- $\hat{v}_{O-}=-\left[\left(\frac{R_4}{R_3}\right)V_{DD}+\left(1+\frac{R_4}{R_3}\right)V_D\right]/\left(\frac{2}{3}-\frac{1}{3}\frac{R_4}{R_3}\right)$
- For phase-shift oscillators,
- at least 3 level of RC ladder is needed.
- $A(j\omega)\beta(j\omega)=\frac{\omega^2C^2RR_f}{4+j(3\omega CR-1/\omega CR)}$.
- For quadrature oscillators,
- two integrators in series are used, and a resistor $R_f=2R$ is used to present a negative effective resistance $-R_f$.
- $L(s)=-\frac{1}{s^2C^2R^2}=\frac{1}{\omega^2C^2R^2}$.
- $\omega_0=\frac{1}{CR}$.
- For Colpitts oscillators,
- $\omega_0=1/\sqrt{L\left(\frac{C_1C_2}{C_1+C_2}\right)}$.
- $A\beta=A\frac{C_1}{C_2}=(g_m R)\left(\frac{C_1}{C_2}\right)$.
- oscillations will start when $g_mR>\frac{C_2}{C_1}$.
- For Hartley oscillators,
- $\omega_0=\frac{1}{\sqrt{(L_1+L_2)C}}$.
- $A\beta=A\frac{L_2}{L_1}=(g_m R)\left(\frac{L_2}{L_1}\right)$.
- oscillations will start when $g_mR>\frac{L_1}{L_2}$.
- For cross-coupled LC oscillators,
- $\omega_0=\frac{1}{\sqrt{LC}}$.
- $A_1=A_2=-g_m(R_p||r_o)$
- oscillations will start when $g_m(R_p||r_o)\geq 1$.
- Properies of piezoelectric crystal:
- $Z(s)=1/\left[sC_p+\frac{1}{sL+1/sC_s}\right]=\frac{1}{sC_p}\frac{s^2+(1/LC_s)}{s^2+[(C_p+C_s)/LC_sC_p]}$.
- $Z(j\omega)=-j\frac{1}{\omega C_p}\left(\frac{\omega^2-\omega_s^2}{\omega^2-\omega_p^2}\right)$, $\omega_s=\frac{1}{\sqrt{LC_s}}$, $\omega_p=1/\sqrt{L\left(\frac{C_sC_p}{C_s+C_p}\right)}$.
- In the inverting bistable circuit, $V_{TL}=\beta L_-$, $V_{TH}=\beta L_+$. In the noninverting bistable circuit, $V_{TL}=-L_+\frac{R_1}{R_2}$, $V_{TH}=-L_-\frac{R_1}{R_2}$.
## Practice
- 13.1, 13.2
- 13.10, 13.11, 13.12, 13.13, 13.14
- 13.32, 13.33
- 13.43, 13.44, 13.45
- 13.52, 13.54, 13.55
- 13.62, 13.63, 13.64
- 13.68, 13.69
- 13.73, 13.74
- 13.78, 13.81
- 13.90, 13.91, 13.92
- 13.108, 13.109
- 13.114, 13.115, 13.117