% Frequence Sim for Res divider on encoder inputs, to determine if we need
% capacitors for higher frequency signal attenuation.
clear; close all;
% fmax = 171e3;
% lambda = 1/fmax
% 
% 
% %% math for over the top current sense
% 
% Vdrop = 200e-3; %mV
% Imax  = 50; %A
% Rshunt = Vdrop/Imax %ohms
% 
% Vout = 2.7; %V
% R2oR1 = Vout/(Imax*Rshunt)


%% divider for -/+ 10 signal
Vin = 10;
R1  = 10e3;
R3  = [0:1:10e3];
Vout= Vin - (2*R1*Vin)./(2*R1 +R3);
plot(R3,Vout);
grid on;
xlabel('Resistance (\ohm)');
ylabel('V_{out}');
title('Divider Curve for +/-10VDC input');
%% divider curve for 0-10 signal
Vin = 10;
R1  = 10e3;
R2  = [0:1:10e3];
Vout = (R2*Vin)./(R1+R2);
figure()
plot(R2,Vout);
grid on;
xlabel('Resistance (\ohm)');
ylabel('V_{out}');
title('Divider Curve for 0-10VDC input');
