Resistor Maker in MATLAB
Example: Say you want a 26.5 Ohm resistor and have [1 20 2 3 1 6 3] Ohm resistors on hand...
>> rMaker(26.5,[1 20 2 3 1 6 3], 0)
The first element within tolerance
(((1||1)+6)+20) = 26.5
Where || is a parallel connection and + is a series connection.
You can even give a tolerance!
>> rMaker(16.432,[1 1 10 4 2 2 2], 0.02)
The first element within tolerance
((((((1+2)+2)||2)+1)+4)+10) = 16.4286
Not that fast, but was some fun.
This code also contains a handy function matCount that can tile every combination given to it to vector length n. You can use it to make truth tables, etc.
e.g
>> matCount([1 2], 3)
ans =
1 1 1
1 1 2
1 2 1
1 2 2
2 1 1
2 1 2
2 2 1
2 2 2
>> matCount([1 0], 3)
ans =
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
Cite As
Josip (2024). Resistor Maker in MATLAB (https://www.mathworks.com/matlabcentral/fileexchange/44283-resistor-maker-in-matlab), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |