.calculator-container {
max-width: 600px;
margin: 40px auto;
padding: 20px;
border: 2px solid #ccc;
border-radius: 12px;
background-color: #f9f9f9;
font-family: Arial, sans-serif;
}
.calculator-container h2 {
text-align: center;
margin-bottom: 5px;
}
.calculator-container p {
text-align: center;
font-size: 14px;
margin-bottom: 20px;
}
.calc-group {
margin-bottom: 30px;
padding: 15px;
border: 1px solid #ddd;
border-radius: 10px;
background: #fff;
}
.calc-group h3 {
text-align: center;
margin-bottom: 15px;
}
.form-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
}
.form-row label {
flex: 1;
}
.form-row input, .form-row select {
flex: 2;
padding: 6px;
margin-left: 10px;
}
.form-buttons {
text-align: center;
margin-top: 15px;
}
.form-buttons button {
padding: 8px 18px;
margin: 5px;
font-size: 14px;
border-radius: 6px;
border: none;
background-color: #3498db;
color: white;
cursor: pointer;
}

Inverting Amplifier Calculator

Calculate Gain, Resistor values, or Voltages for an inverting op-amp configuration.

Calculate Gain, R1 or Rf

Ω

Ω


Calculate Gain, Vin or Vout

V
mV

V
mV


function calcBlock1() {
let r1 = parseFloat(document.getElementById(“r1”).value);
let r1u = parseFloat(document.getElementById(“r1_unit”).value);
let rf = parseFloat(document.getElementById(“rf”).value);
let rfu = parseFloat(document.getElementById(“rf_unit”).value);
let gain = parseFloat(document.getElementById(“gain1”).value);

r1 = isNaN(r1) ? null : r1 * r1u;
rf = isNaN(rf) ? null : rf * rfu;
gain = isNaN(gain) ? null : gain;

if (r1 !== null && rf !== null && gain === null) {
document.getElementById(“gain1”).value = -(rf / r1).toFixed(3);
} else if (gain !== null && r1 !== null && rf === null) {
document.getElementById(“rf”).value = Math.abs(gain * r1 / rfu).toFixed(3);
} else if (gain !== null && rf !== null && r1 === null) {
document.getElementById(“r1”).value = Math.abs(rf / gain / r1u).toFixed(3);
} else {
alert(“Please leave one field blank to calculate it.”);
}
}

function clearBlock1() {
document.getElementById(“r1”).value = “”;
document.getElementById(“rf”).value = “”;
document.getElementById(“gain1”).value = “”;
}

function calcBlock2() {
let gain = parseFloat(document.getElementById(“gain2”).value);
let vin = parseFloat(document.getElementById(“vin”).value);
let vinu = parseFloat(document.getElementById(“vin_unit”).value);
let vout = parseFloat(document.getElementById(“vout”).value);
let voutu = parseFloat(document.getElementById(“vout_unit”).value);

vin = isNaN(vin) ? null : vin * vinu;
vout = isNaN(vout) ? null : vout * voutu;

if (gain !== null && vin !== null && vout === null) {
document.getElementById(“vout”).value = (-gain * vin / voutu).toFixed(3);
} else if (gain !== null && vout !== null && vin === null) {
document.getElementById(“vin”).value = (-vout / gain / vinu).toFixed(3);
} else if (vin !== null && vout !== null && gain === null) {
document.getElementById(“gain2”).value = (-vout / vin).toFixed(3);
} else {
alert(“Please leave one field blank to calculate it.”);
}
}

function clearBlock2() {
document.getElementById(“gain2”).value = “”;
document.getElementById(“vin”).value = “”;
document.getElementById(“vout”).value = “”;
}


(adsbygoogle = window.adsbygoogle || []).push({});