## Round to Electronic Component Values

version 2.0.0 (70.8 KB) by
Round numeric array values to the best matching IEC 60063 resistor values (E-Series).

Updated 12 Jul 2021

ROUND63 rounds numeric values to electronic component values defined in IEC 60063 (aka IEC 63, preferred numbers for resistor, capacitor, and inductor values). By default the rounding bin edges approximate component tolerance boundaries, an optional input selects round-to-nearest, rounding up, and rounding down. Supports E-series E3/E6/E12/E24/E48/E96/E192, e.g. E6 = [...,10,15,22,33,47,68,100,150,220,...]
### Bonus Functions ###
The bonus function ROUND63_VIEW creates a figure that demonstrates how ROUND63's rounding bin edges correspond to the component tolerances.
The bonus function NUM2CIRCUIT uses an exhaustive search to find the component values whose equivalent circuit value is closest to the input value. The circuit can be either a parallel or series circuit (of resistors, capacitors, or inductors).
### Examples ###
>> round63(500, "E12")
ans = 470
>> round63([5,42,18,100], 'E12')
ans = [4.7, 39, 18, 100]
>> round63([5,42,18,100], 'E6') % default = 'harmonic'
ans = [4.7, 47, 22, 100]
>> round63([5,42,18,100], 'E6', 'up')
ans = [6.8, 47, 22, 100]
>> round63([5,42,18,100], 'E6', 'down')
ans = [4.7, 33, 15, 100]
>> round63([5,42,18,100], 'E6', 'arithmetic')
ans = [4.7, 47, 15, 100]
>> [Y,idx,pns,edg] = round63([5,42,18,100], 'E3')
Y = [4.7, 47, 22, 100]
idx = [ 1, 4, 3, 5]
pns = [4.7; 10; 22; 47; 100]
edg = [2.9971; 6.3946; 13.75; 29.971; 63.946; 137.5]
>> [Y,idx,pns,edg] = round63([-Inf,Inf,NaN; -1, 0, 1], 'E3')
Y = [NaN, NaN, NaN; NaN, NaN, 1]
idx = [NaN, NaN, NaN; NaN, NaN, 1]
pns = 1
edg = [0.63946; 1.375]

### Cite As

Stephen (2021). Round to Electronic Component Values (https://www.mathworks.com/matlabcentral/fileexchange/48840-round-to-electronic-component-values), MATLAB Central File Exchange. Retrieved .

##### MATLAB Release Compatibility
Created with R2010b
Compatible with any release
##### Platform Compatibility
Windows macOS Linux