clc
global n0 n1 n2 n3 n4 x rho_p0 rho_p1 rho_p2 rho_p3 rho_p4 rho_w rho_g M_p m_e 
rho_w=input ('Enter sea water density at 25m depth (usually around 1020kg/m3)='); %density of sea water can be calculated using the CSGNetwork calculator
rho_p0=1025; %values for density of microplastics may be manually changed in the script. Note that for model to work, the assumption that density of plastic is higher than density of water must be observed
rho_p1=1030;
rho_p2=1040;
rho_p3=1050;
rho_p4=1060;
m_e=1*10^-15;
rho_g=1.2;
rho_e=10000/7;
x=input ('Enter volume ratio of gas vesicles: e.coli that is expected to be produced=');
a0=((rho_w./rho_p0)-1);
a1=((rho_w./rho_p1)-1);
a2=((rho_w./rho_p2)-1);
a3=((rho_w./rho_p3)-1);
a4=((rho_w./rho_p4)-1);
b=(m_e+((1/(rho_e.*(1-x)))*((x.*m_e.*rho_g)-(m_e.*rho_w))));
total0=a0./b;
total1=a1./b;
total2=a2./b;
total3=a3./b;
total4=a4./b;

M_p=(0:1:10);
n0 = M_p.*total0;
n1 = M_p.*total1;
n2 = M_p.*total2;
n3 = M_p.*total3;
n4 = M_p.*total4;

plot (M_p, n0);hold on
plot (M_p, n1,'r');hold on
plot (M_p, n2,'g');hold on
plot (M_p, n3,'y');hold on
plot (M_p, n4,'k');hold off
xlabel ('Mass of Aggregated Plastic to be kept buoyant (kg)')
ylabel ('Number of e.coli cells required')
legend ('plastic density 1025 kg/m3', '1030 kg/m3','1040 kg/m3','1050 kg/m3','1060 kg/m3')
set(legend,'Location','EastOutside')