Skip to content

Instantly share code, notes, and snippets.

@plumbum
Created June 30, 2014 09:41
Show Gist options
  • Save plumbum/5ecf099e8ab7987b6cd7 to your computer and use it in GitHub Desktop.
Save plumbum/5ecf099e8ab7987b6cd7 to your computer and use it in GitHub Desktop.
<?php
$resistor = array(
1.0,
1.1,
1.2,
1.3,
1.5,
1.6,
1.8,
2.0,
2.2,
2.4,
2.7,
3.0,
3.3,
3.6,
3.9,
4.3,
4.7,
5.1,
5.6,
6.2,
6.8,
7.5,
8.2,
9.1,
);
function Vovp($r1, $r2) {
$Vfb = 1.235;
return (($r1+$r2)/$r2)*$Vfb;
}
foreach($resistor as $r2) {
foreach($resistor as $r1) {
$v = Vovp($r1, $r2);
if(round($v) == 5) {
echo "Vovp=$v; R1=".($r1).", R2=$r2\r\n";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment