function [ DC ] = CurrentToDC( I )

%Returns duty cycle in percent that will draw the specified current

PWM = 0:2.5:100;
Ilimit = [47.1 45.98 44.79 43.58 42.4 41.21 40.02 38.84 37.64 36.45 35.25 34.07 32.88 31.68 30.50 29.29 28.10 26.93 25.73 24.50 23.38 22.18 20.99 19.80 18.61 17.40 16.22 15.02 13.83 12.64 11.4 10.23 9.04 7.86 6.65 5.44 4.28 3.07 1.86 .69 .01];

pp = interp1(Ilimit,PWM,'linear','pp');

DC = ppval(pp,I);

if(DC < 0) DC = 0; end
if(DC > 100)  DC = 100; end

end

