Created
November 25, 2017 17:19
-
-
Save bencholmes/87ceeaee702ec0dc1d0426283d2ae2f6 to your computer and use it in GitHub Desktop.
Versatile logarithmic potentiometer law model.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% travel is the location of the wiper along the pot from 0 to 1 | |
travel = linspace(0,1,1000); | |
% Define the factor of resistance at the middle pot position | |
mid = 0.15; | |
% b is the base of the exponential equation | |
b = (1/mid - 1)^2; | |
% a is the multiple and also the offset | |
a = 1/(b-1); | |
% Calculate the resistance | |
resistance = a*b.^travel - a; | |
figure; | |
plot(travel,resistance) | |
xlabel('Potentiometer Position'); ylabel('Resistance Factor'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment