close all
clear all


R1 = 10000;
R2 = 10000;
R3 = 4530;
R4 = 10000;
Ron = 200;
Roff = 3e8;

VR1 = 15;

VR3 = 0:.001:3.0;

VR2 = (R2+R3)*VR3/R3;

Rlow = VR2*R1./(VR1-VR2);

Rext = 1./(1./Rlow+1./(R2+R3));

N = (Ron+R4)*(Roff+R4)./Rext -24*(Ron+R4);

N = N/(Roff-Ron);

plot(VR3,N);
ylim([0 24]);


   K1 = (R2+R3)/R3;
   K2 = 1.0/(R2+R3);
   K3 = (Ron+R4)*(Roff+R4);
   K4 = 24*(Ron+R4);
   K5 = (Roff-Ron);

   VR2 = K1*VR3;
   Rlow_inv = (VR1-VR2)./(VR2*R1);
   Rext_inv = Rlow_inv-K2;
   N_fp = (K3*Rext_inv-K4)/K5;

   figure
   plot(VR3,N_fp)
   ylim([0 24]);