% AsymetricMembrane: 
%
% Simulation script to explore the effect of 
% an asymetric distribution of membrane on Amplification
%
% Last updated 10/12/2005 MDO
%---------------------------------

close all, clear


% Cell Radius
R0 = 1;

% Sample N discrete points about cell
N = 100;

theta = linspace(-pi,pi,N);

% Define External concetration of Attractant
% about cell centered in cartesian coor. system
% L(x,y) = ax + b;

a =.4;
b = 1;
L = b + a*R0*cos(theta);

% Cell 1 has an even distribution of recepotrs
R = 1 + 0*cos(theta);

%Distriubtion of ligand-receptor complexes
%(assuming steaty-state, monovalent binding)
C = L.*R;

% True amplfication.  
K = 1;

% Output of cell 1
phi1 = C*K;

% Make cell 2 with 20% more receptors at front
% and 20% less receptors at back
R2 = R + 0.2*cos(theta);
C2 = L.*R2;

% Uncorrected output of cell #2:
phi2 = K*C2;

% Corrected output of cell #2:
phiN = phi2./R2;


%Check that we recover the true amplfication:

% Amplfication of cell #1
Amp1 = (max(phi1) - min(phi1)) / (max(L)-min(L))  * (min(L)/min(phi1));

% Uncorrected amplfication of cell #2
Amp2 = (max(phi2) - min(phi2)) / (max(L)-min(L))  * (min(L)/min(phi2));

% Corrected amplfication of cell #2
Amp3 = (max(phiN) - min(phiN)) / (max(L)-min(L))  * (min(L)/min(phiN));


disp(['True amplification = ',num2str(Amp1)]);
disp(['Uncorrected amplification = ',num2str(Amp2)]);
disp(['Corrected amplification = ', num2str(Amp3)]);


%Make Figures:
%--------------

figure(1)

plot(theta,phi1,'linewidth',2);
hold on;

plot(theta,phi2,'g--','linewidth',2);
xlabel('\theta','FontSize',12);
ylabel('Output ','FontSize',12);


figure(2)
scatter(L,phi1);
hold on;

scatter(L,phi2,'g+');

xlabel('Input','FontSize',12);

ylabel('Output','FontSize',12);

