reno80
2013-04-23, 02:51
function Apred = diffusionATR(beta,t) % The calculation from this programm are returned back to programm Appendix B1a. The nlinfit function is used to obtain Apred(predicted absorbance value)
b1 = 0.4; %Predicted best fit diffusion coefficient
b2 = 0.73; %Predicted equilibrium absorbance
global L % Thickness of PA Film
t=xlsread('diffusiondaten.xls','A2:A72')' %(sec) First column in file diffusiondaten.xls gives time 't'
t=t(:)
nt=length(t);
n=100; %Number of terms in the infinite series
n1=1.4; %Refractive index of PA
n2=2.43;%Refractive index of ATR crystal
angle=pi/4;%Incident angle of IR rays
wavenumber=1043.85;%Wavenumber of (-C=C-) stretching in eugenol
lambda=1/wavenumber;%Wavelength
gamma=(2*n2*pi*sqrt((sin(angle))^2-((n1/n2)^2)))/lambda%gamma or the decay coefficient
%Solution toward the infinite series or summation in Fickian diffsion model
for i=1:nt
for j=0:n
f(j+1)=((2.*j+1).*pi)./(2*L);
g(j+1)=((-b1*10^(-10)).*(2.*j+1)^2.*pi^2.*t(i))./(4*L^2);
h(j+1)=(exp(g(j+1))*(f(j+1).*exp(-2*gamma*L)+(-1)^j.*(2*gamma))./((2.*j).*(4*gamma^2+f(j+1)^2)));
end
A(i) = b2*(1-8*gamma/(pi*(1-exp(-2*gamma*L))).*sum(h));
end
Apred = A; %Predicted absorbance values
--------------------------------------------------------
程序运行gamma可以算出来
但是运行下面For语句的时候,
n an assignment A(I) = B, the number of elements in B and
I must be the same.
Error in ==> diffusionATR at 22
f(j+1)=((2.*j+1).*pi)./(2*L);
不明白为什么左右二边不匹配,左边f(j+1)应该是(f1,f2,f3,.......f101),右边是从j=0开始到100,也是101个值。
什么问题呢?
求高人指点
b1 = 0.4; %Predicted best fit diffusion coefficient
b2 = 0.73; %Predicted equilibrium absorbance
global L % Thickness of PA Film
t=xlsread('diffusiondaten.xls','A2:A72')' %(sec) First column in file diffusiondaten.xls gives time 't'
t=t(:)
nt=length(t);
n=100; %Number of terms in the infinite series
n1=1.4; %Refractive index of PA
n2=2.43;%Refractive index of ATR crystal
angle=pi/4;%Incident angle of IR rays
wavenumber=1043.85;%Wavenumber of (-C=C-) stretching in eugenol
lambda=1/wavenumber;%Wavelength
gamma=(2*n2*pi*sqrt((sin(angle))^2-((n1/n2)^2)))/lambda%gamma or the decay coefficient
%Solution toward the infinite series or summation in Fickian diffsion model
for i=1:nt
for j=0:n
f(j+1)=((2.*j+1).*pi)./(2*L);
g(j+1)=((-b1*10^(-10)).*(2.*j+1)^2.*pi^2.*t(i))./(4*L^2);
h(j+1)=(exp(g(j+1))*(f(j+1).*exp(-2*gamma*L)+(-1)^j.*(2*gamma))./((2.*j).*(4*gamma^2+f(j+1)^2)));
end
A(i) = b2*(1-8*gamma/(pi*(1-exp(-2*gamma*L))).*sum(h));
end
Apred = A; %Predicted absorbance values
--------------------------------------------------------
程序运行gamma可以算出来
但是运行下面For语句的时候,
n an assignment A(I) = B, the number of elements in B and
I must be the same.
Error in ==> diffusionATR at 22
f(j+1)=((2.*j+1).*pi)./(2*L);
不明白为什么左右二边不匹配,左边f(j+1)应该是(f1,f2,f3,.......f101),右边是从j=0开始到100,也是101个值。
什么问题呢?
求高人指点