A first-order RC low-pass filter has cutoff frequency \(f_c = \dfrac{1}{2\pi R C}\) , where the response is \(-3\) dB. Drag the sliders to see how the components set the cutoff.
viewof R = Inputs. range ([100 , 100000 ], {value : 10000 , step : 100 , label : "R (Ω)" })
viewof C_nF = Inputs. range ([1 , 1000 ], {value : 100 , step : 1 , label : "C (nF)" })
fc = 1 / (2 * Math . PI * R * (C_nF * 1e-9 ))
html `<p style="font-size:1.15rem;margin:.4rem 0 1rem">Cutoff frequency <b>f<sub>c</sub> = ${ fc. toLocaleString ("en" , {maximumFractionDigits : 1 })} Hz</b></p>`
Plot. plot ({
width : 660 , height : 280 ,
marginLeft : 55 ,
x : { type : "log" , label : "frequency (Hz)" , domain : [10 , 1e6 ] },
y : { label : "|H| (dB)" , domain : [- 40 , 3 ], grid : true },
marks : [
Plot. line (
d3. range (1 , 6.01 , 0.02 ). map (e => 10 ** e). map (f => ({ f, H : 20 * Math . log10 (1 / Math . sqrt (1 + (f / fc) ** 2 )) })),
{ x : "f" , y : "H" , stroke : "#0E4D64" , strokeWidth : 2 }
),
Plot. ruleX ([fc], { stroke : "#6C4AB6" , strokeDasharray : "4 3" }),
Plot. ruleY ([- 3 ], { stroke : "#9aa4b2" , strokeDasharray : "2 3" })
]
})