MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB基础] 紧急求助, 求高人指点 (https://www.labfans.com/bbs/showthread.php?t=18805)

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个值。

什么问题呢?


求高人指点

reno80 2013-04-23 15:54

回复: 紧急求助, 求高人指点
 
自己顶下:)
求帮忙

zhou1990 2013-04-24 09:41

回复: 紧急求助, 求高人指点
 
我有程序代码,有数据,谁能帮我运行出结果,我有重谢,有意者请联系我,QQ976171645

zhaojing6828 2013-06-07 19:38

回复: 紧急求助, 求高人指点
 
clc;
close all
clear all
f(1)=0;
for j=0:100
f(j+1)=((2.*j+1).*pi)./(2*1);
end
我这样运行了一下,没错,你试试


所有时间均为北京时间。现在的时间是 12:31

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.