%% E3_9 %% Carol Lucas %% This program computes the Eadie-Hofstress plot using direct solutions %% that are possible since this is a linear system as well as going through %% simulations - more like the experimental approach would be. format compact Gin=0.0; Gray=[2:2:20]; N=length(Gray); mess=' Model tested over even Gout values between two and twenty.' mess=' Each simulation is proceeded by a PAUSE. Hit return to continue.' for k=1:N; Gout=Gray(k) k12=2.4;k43=2.4;k21=42;k34=42;k14=1000;k41=1000;k23=1000;k32=1000; %% METHOD 1: Solve directly for ss values A=[-k12*Gout-k41-k14 k21-k41 -k41; k12*Gout -k21-k23 k32; - k43*Gin k23-k43*Gin -k32-k34-k43*Gin]; b=[k41; 0; k43*Gin]; Xss=-inv(A)*b; x1ss=Xss(1);x2ss=Xss(2);x3ss=Xss(3);x4ss=1-x1ss-x2ss-x3ss; R(k)=2*(k34*x3ss-k43*x4ss*Gin); %% Method 2 - like an experimenter would do it [t,x]=ode45('glutfun',[0:.01:.3],[1;0;0],[],Gin,Gout); figure(1);clf;plot(t,x);pause; last=length(t); x1ss=x(last,1);x2ss=x(last,2);x3ss=x(last,3);x4ss=1-x1ss-x2ss-x3ss; Rexp(k)=2*(k34*x3ss-k43*x4ss*Gin); end mess = 'END RESULTS EXACT METHOD, Hit return to continue' plot(R./Gray,R,'ro');xlabel('R/Gout');ylabel('R'); title(' Direct Solution of SS with fit');hold on; x1=R(2)/Gray(2); y1=R(2); x2=R(N)/Gray(N); y2=R(N); slope=(y2-y1)/(x2-x1) Rmax=y1-slope*x1 ytest=Rmax+slope*R./Gray; plot(R./Gray,ytest);pause; Mess= 'END RESULTS EXPERIMENTAL METHOD' R=Rexp; figure(2);clf;plot(R./Gray,R,'ro');xlabel('R/Gout');ylabel('R'); title('Simulated Steady State with fit');hold on; x1=R(2)/Gray(2); y1=R(2); x2=R(N)/Gray(N); y2=R(N); slope=(y2-y1)/(x2-x1) Rmax=y1-slope*x1 ytest=Rmax+slope*R./Gray; plot(R./Gray,ytest);