No BSD License  

Highlights from
MATLAB for Engineers

from MATLAB for Engineers by Adrian Biran
Companion Software

ayrton(range, amp, resist)
function        R = ayrton(range, amp, resist)
%AYRTON calculates resistances for an Ayrton multirange ammeter.
%       Input:
%               range  = array of ranges, mA, given in descending
%                        order and excluding the first range
%               amp    = movement rating, mA
%               resist = ammeter resistance, ohm
%       This function solves Exercise 6.18.

n = length(range); A = -amp*ones(n);
for k = 1:n
        for l = 1:k
                A(k,l) = range(k) - amp;
        end
end
B = resist*ones(n, 1); R = A\B

Contact us at files@mathworks.com