Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Everything about electronics
Everything about electronics
Calculate resonant frequency, inductance, or capacitance using the LC resonance formula:
f = 1 / (2π√(LC))
Hz
kHz
MHz
µH
mH
H
pF
nF
µF
function calculateLC() {
const f = parseFloat(document.getElementById(“frequency”).value);
const L = parseFloat(document.getElementById(“inductance”).value);
const C = parseFloat(document.getElementById(“capacitance”).value);
const fUnit = parseFloat(document.getElementById(“fUnit”).value);
const lUnit = parseFloat(document.getElementById(“lUnit”).value);
const cUnit = parseFloat(document.getElementById(“cUnit”).value);
let result = “”;
const pi = Math.PI;
if (!isNaN(L) && !isNaN(C)) {
// Calculate Frequency
const freq = 1 / (2 * pi * Math.sqrt((L * lUnit) * (C * cUnit)));
result = `Frequency = ${freq.toFixed(3)} Hz`;
} else if (!isNaN(f) && !isNaN(C)) {
// Calculate Inductance
const induct = 1 / ((2 * pi * f * fUnit) ** 2 * (C * cUnit));
result = `Inductance = ${(induct / lUnit).toFixed(3)} H`;
} else if (!isNaN(f) && !isNaN(L)) {
// Calculate Capacitance
const capac = 1 / ((2 * pi * f * fUnit) ** 2 * (L * lUnit));
result = `Capacitance = ${(capac / cUnit).toFixed(3)} F`;
} else {
result = “Please fill any two fields.”;
}
document.getElementById(“lcResult”).innerText = result;
}
function resetLC() {
document.getElementById(“frequency”).value = “”;
document.getElementById(“inductance”).value = “”;
document.getElementById(“capacitance”).value = “”;
document.getElementById(“lcResult”).innerText = “”;
}
(adsbygoogle = window.adsbygoogle || []).push({});