Round to Electronic Component Values

version 2.0.2 (70.8 KB) by Stephen23
Round numeric array values to IEC 60063 resistor/capacitor values (E-Series).

1K Downloads

Updated Thu, 02 Jun 2022 15:09:40 +0000

View License

ROUND63 rounds numeric values to electronic component values defined in IEC 60063 (preferred numbers for resistor, capacitor, and inductor values, previously IEC 63). 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, and E192. For example, 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

Stephen23 (2022). 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 R2009b and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!