zhgtt
2011-08-03, 16:30
老是出现??? Undefined function or variable 'p'.,明明定义了p的。程序中调用函数在另外的m文件中定义
clear all;clc
global C
t=[0:300:2400]; % t:时间,s
C=[0.00 0.11 0.19 0.25 0.31 0.44 0.54 0.62 0.65;
0.00 0.10 0.18 0.24 0.28 0.39 0.48 0.52 0.53;
0.10 3.20 1.70 1.30 2.50 3.90 5.20 8.20 9.7];
C=C';%温度150℃的动力学实验数据C(1) &C(2): kmol/m^3, C(3):%
%非线性拟合
kk0=[5.1095e-004; 2.8939;9.5453e+003];
%利用suresh模型算出同样温度条件下的速率常数作为其初始值
tspan=[0:300:2400]; %时间阶梯
C0=[0;0;0.1]; % 0.1:氧气在反应体系气相中的初始分率,考虑了环己烷的饱和蒸
%汽压,在实验条件下为50%左右,除去该蒸汽压以及惰性气体所
%占的比例后得出的上述数值
kk=lsqnonlin(@OptObjFunc,kk0,0,inf,[ ],tspan,C0,C); %非线性最小二乘法拟合。调用函数
ci=nlparci(beta,resid,jacobian); %回归系数,残差,雅阁比矩阵
%拟合效果图(实验值与拟合值的比较)
M=[ 1 0 0 0; %解微分代数方程组时的系数矩阵
0 1 0 0;
0 0 0 0;
0 0 0 0];
options=odeset; %产生/改变参数结构
options.Mass=M;
options.TolRol=le-7;%定义精度
tspan=[5:40];
C0=[0;0;0.1 ];%初值C
p=1.2;%MPa
G=1.5;%L/min
kla=0.14;%1/s;
apxl=input('Pls.input gas holdup you got according reaction conditions using hydro_mass_ c:','s');
[t sim,C sim]=ode45(@ljssm,tspan,CO,options,kk,p,G,kla,apxl);
plot(t,C exp(:,1),'-ks',t sim,C sim(:,1),':ko',t,C exp(:,2),'-kd',t sim,C sim(:,2),':k+')
legend('Exp.CP','Model.CP','Exp.CI','Mode1.CI'),xlabel('时间t/s'),ylabel('浓度C/(kmol/m^3)')
clear all;clc
global C
t=[0:300:2400]; % t:时间,s
C=[0.00 0.11 0.19 0.25 0.31 0.44 0.54 0.62 0.65;
0.00 0.10 0.18 0.24 0.28 0.39 0.48 0.52 0.53;
0.10 3.20 1.70 1.30 2.50 3.90 5.20 8.20 9.7];
C=C';%温度150℃的动力学实验数据C(1) &C(2): kmol/m^3, C(3):%
%非线性拟合
kk0=[5.1095e-004; 2.8939;9.5453e+003];
%利用suresh模型算出同样温度条件下的速率常数作为其初始值
tspan=[0:300:2400]; %时间阶梯
C0=[0;0;0.1]; % 0.1:氧气在反应体系气相中的初始分率,考虑了环己烷的饱和蒸
%汽压,在实验条件下为50%左右,除去该蒸汽压以及惰性气体所
%占的比例后得出的上述数值
kk=lsqnonlin(@OptObjFunc,kk0,0,inf,[ ],tspan,C0,C); %非线性最小二乘法拟合。调用函数
ci=nlparci(beta,resid,jacobian); %回归系数,残差,雅阁比矩阵
%拟合效果图(实验值与拟合值的比较)
M=[ 1 0 0 0; %解微分代数方程组时的系数矩阵
0 1 0 0;
0 0 0 0;
0 0 0 0];
options=odeset; %产生/改变参数结构
options.Mass=M;
options.TolRol=le-7;%定义精度
tspan=[5:40];
C0=[0;0;0.1 ];%初值C
p=1.2;%MPa
G=1.5;%L/min
kla=0.14;%1/s;
apxl=input('Pls.input gas holdup you got according reaction conditions using hydro_mass_ c:','s');
[t sim,C sim]=ode45(@ljssm,tspan,CO,options,kk,p,G,kla,apxl);
plot(t,C exp(:,1),'-ks',t sim,C sim(:,1),':ko',t,C exp(:,2),'-kd',t sim,C sim(:,2),':k+')
legend('Exp.CP','Model.CP','Exp.CI','Mode1.CI'),xlabel('时间t/s'),ylabel('浓度C/(kmol/m^3)')