Skip to content

Commit 1e735b9

Browse files
Add Laplace Transform Basics documentation and remove outdated table of contents
1 parent eb98b8f commit 1e735b9

3 files changed

Lines changed: 393 additions & 123 deletions

File tree

Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
# Laplace Transform Basics for Circuit Simulation
2+
3+
Laplace transforms can look intimidating because they come from higher math, but you do not need to become a mathematician before using `LAPLACE` sources in SPICE.
4+
5+
For circuit simulation, the practical idea is simple:
6+
7+
```text
8+
output = transfer_function * input
9+
```
10+
11+
The transfer function describes how a linear block changes a signal. It can say "amplify by 10", "roll off after 1 kHz", "remove DC", "lag the phase", or "ring like a damped resonator".
12+
13+
If you want the exact syntax supported by SpiceSharpParser, see [LAPLACE Transfer Sources](laplace.md). This page focuses on the intuition.
14+
15+
## Time Domain And Frequency Domain
16+
17+
The time domain is the waveform you would see on an oscilloscope:
18+
19+
```text
20+
voltage versus time
21+
```
22+
23+
It answers questions like:
24+
25+
| Question | Example |
26+
|----------|---------|
27+
| How fast does the output rise? | Step response |
28+
| Does it overshoot? | Damped resonance |
29+
| Does it settle? | Filter or control loop response |
30+
31+
The frequency domain is the same circuit viewed by sine waves at different frequencies:
32+
33+
```text
34+
gain and phase versus frequency
35+
```
36+
37+
It answers questions like:
38+
39+
| Question | Example |
40+
|----------|---------|
41+
| Which frequencies pass through? | Low-pass filter |
42+
| Which frequencies are blocked? | High-pass coupling |
43+
| How much delay or phase shift is added? | Op-amp bandwidth |
44+
45+
SPICE `.AC` analysis is frequency-domain analysis. It tries many frequencies and reports the output magnitude and phase.
46+
47+
## What `s` Means
48+
49+
A Laplace transfer function is written with a variable named `s`:
50+
51+
```text
52+
H(s)
53+
```
54+
55+
Think of `s` as a placeholder that lets one expression describe both DC and AC behavior.
56+
57+
For operating point analysis:
58+
59+
```text
60+
s = 0
61+
```
62+
63+
For AC analysis at frequency `f`:
64+
65+
```text
66+
s = j * omega
67+
omega = 2 * pi * f
68+
```
69+
70+
`j` means a 90 degree phase rotation. You do not need to calculate complex numbers by hand every time. The useful rule is:
71+
72+
- The magnitude of `H(j*omega)` is the gain at that frequency.
73+
- The angle of `H(j*omega)` is the phase shift at that frequency.
74+
75+
## Gain And Phase
76+
77+
Gain says how much bigger or smaller the output is than the input.
78+
79+
```text
80+
gain = output / input
81+
```
82+
83+
Examples:
84+
85+
| Gain | Meaning |
86+
|------|---------|
87+
| `1` | Same amplitude |
88+
| `10` | Ten times larger |
89+
| `0.5` | Half amplitude |
90+
| `-10` | Ten times larger and inverted |
91+
92+
Phase says how much the output sine wave is shifted relative to the input sine wave.
93+
94+
| Phase | Meaning |
95+
|-------|---------|
96+
| `0 deg` | Output lines up with input |
97+
| `-45 deg` | Output lags input |
98+
| `+45 deg` | Output leads input |
99+
| `180 deg` | Output is inverted |
100+
101+
For many first-order filters, the phase shift is most noticeable around the cutoff frequency.
102+
103+
## Time Constants And Cutoff Frequency
104+
105+
A first-order RC low-pass has this transfer function:
106+
107+
```text
108+
H(s) = 1 / (1 + s*tau)
109+
```
110+
111+
`tau` is the time constant:
112+
113+
```text
114+
tau = R * C
115+
```
116+
117+
The cutoff frequency is:
118+
119+
```text
120+
fc = 1 / (2*pi*tau)
121+
```
122+
123+
At the cutoff frequency:
124+
125+
- The gain is about `0.707` of the low-frequency gain.
126+
- The magnitude is down by about `3 dB`.
127+
- The phase is about `-45 deg`.
128+
129+
The time-domain meaning of `tau` is also useful: after one time constant, a first-order step response has moved about 63 percent of the way toward its final value.
130+
131+
## Poles And Zeros
132+
133+
Poles and zeros are the frequencies where a transfer function changes behavior.
134+
135+
A pole usually makes gain start falling and phase start lagging:
136+
137+
```text
138+
H(s) = wc / (s + wc)
139+
```
140+
141+
That is a one-pole low-pass filter. Below `fc`, it passes signals. Above `fc`, it rolls off.
142+
143+
A zero usually makes gain start rising and phase start leading:
144+
145+
```text
146+
H(s) = s / (s + wc)
147+
```
148+
149+
That is a one-pole high-pass filter. It blocks DC and low frequencies, then passes high frequencies.
150+
151+
In real circuits:
152+
153+
| Circuit behavior | Typical cause |
154+
|------------------|---------------|
155+
| Low-pass pole | Capacitance, bandwidth limit, averaging |
156+
| High-pass zero at origin | AC coupling, DC blocking |
157+
| Extra pole | Op-amp bandwidth, sensor bandwidth, compensation capacitor |
158+
| Second-order poles | RLC network, mechanical resonance, control-loop plant |
159+
160+
## Reading `H(s)` Without Doing Full Math
161+
162+
Use this quick checklist:
163+
164+
1. Set `s = 0` to find the DC gain.
165+
2. Look for terms like `s + wc` or `1 + s*tau`; these are poles.
166+
3. Look for `s` in the numerator; that often means DC is blocked.
167+
4. Compare the numerator degree with the denominator degree; in SpiceSharpParser, the numerator degree must not be greater.
168+
5. Convert `wc` to hertz with `fc = wc/(2*pi)`.
169+
170+
Examples:
171+
172+
| Transfer | What it does |
173+
|----------|--------------|
174+
| `1/(1+s*tau)` | Unity-gain low-pass |
175+
| `wc/(s+wc)` | Same low-pass, written with angular cutoff |
176+
| `s/(s+wc)` | High-pass that blocks DC |
177+
| `10*wc/(s+wc)` | Gain of 10 with one-pole bandwidth |
178+
| `(1+s/wz)/(1+s/wp)` | Lead or lag block, depending on pole/zero placement |
179+
180+
## Common Physical Blocks
181+
182+
### RC Low-Pass
183+
184+
A resistor feeding a capacitor to ground is a low-pass filter:
185+
186+
```text
187+
H(s) = 1 / (1 + s*R*C)
188+
```
189+
190+
Use it for simple bandwidth limits, anti-alias filters, smoothing, and sensor front ends.
191+
192+
### AC Coupling High-Pass
193+
194+
A series capacitor with a resistor to ground blocks DC:
195+
196+
```text
197+
H(s) = s / (s + wc)
198+
```
199+
200+
Use it when you want changes or AC content, but not the DC level.
201+
202+
### Finite Op-Amp Bandwidth
203+
204+
An ideal gain block has the same gain forever, but a real amplifier loses gain at high frequency. A simple closed-loop approximation is:
205+
206+
```text
207+
H(s) = gain * wp / (s + wp)
208+
```
209+
210+
where:
211+
212+
```text
213+
fp = gain_bandwidth / gain
214+
wp = 2*pi*fp
215+
```
216+
217+
This is not a full op-amp macro-model. It is a compact way to include a dominant bandwidth limit.
218+
219+
### Damped Resonance
220+
221+
Some systems have a natural frequency and damping:
222+
223+
```text
224+
H(s) = wn*wn / (s*s + 2*zeta*wn*s + wn*wn)
225+
```
226+
227+
where:
228+
229+
| Term | Meaning |
230+
|------|---------|
231+
| `wn` | Natural angular frequency |
232+
| `zeta` | Damping ratio |
233+
234+
Smaller `zeta` gives more peaking and ringing. Larger `zeta` gives a flatter, more damped response.
235+
236+
## Good Uses Of LAPLACE Sources
237+
238+
`LAPLACE` sources are best for linear, small-signal behavior:
239+
240+
- Filters with known poles and zeros.
241+
- Sensor or amplifier bandwidth limits.
242+
- Approximate transimpedance or transconductance stages.
243+
- Control-system blocks.
244+
- Comparing an ideal transfer function with a detailed circuit.
245+
246+
They are not a good fit for behavior that is strongly nonlinear:
247+
248+
- Clipping or saturation.
249+
- Slew-rate limiting.
250+
- Startup sequencing.
251+
- Switching ripple.
252+
- Digital logic.
253+
- Temperature-dependent device physics.
254+
255+
For those, use detailed circuit models, behavioral expressions, or device models that directly represent the nonlinear behavior.
256+
257+
## SpiceSharpParser Subset
258+
259+
SpiceSharpParser intentionally supports a practical subset:
260+
261+
- `E` and `G` LAPLACE sources.
262+
- Voltage input expressions: `V(node)` and `V(node1,node2)`.
263+
- Proper rational polynomials in `s`.
264+
- Finite DC gain.
265+
266+
That means many web examples need adaptation before they are valid here. Avoid unsupported forms such as `exp()`, `sqrt()`, pure `1/s`, ideal delay, `TD=`, `DELAY=`, and function-like `VALUE={LAPLACE(...)}` syntax.

0 commit comments

Comments
 (0)