Oprimization problems with differential equations

1 次查看(过去 30 天)
Hello, I have this program and I am trying to make the optimized data converge as best as possible with the real data, but the obtained data (xa) are still very different from the real ones (xe), and I am not able to identify my error. can you help me?
experimental data
t xe
0 0
60 0.2771
120 0.3596
180 0.4266
240 0.4333
300 0.4501
360 0.4519
420 0.4522
clc
clear all
%Initial values
par0 = [3.04e7,65520];
%xe(experimental data)
data = load('Data.txt');
%FO
fun_objetivo = @(par)FunObjetivo(par,data(:,:));
t = data(:,1);
xe= data(:,2);
%Input arguments
A =[]; b =[];
Aeq =[]; beq =[];
lb =[1e6 10000]; ub =[];
IntCon =[]; nonlcon =[];
nvar =2;
%Nelder_Mead
options = optimset('MaxIter',5000,'MaxFunEvals',...
3000,'FunValCheck','off','Display','iter','TolX',1e-7);
%We use here the Nelder-Mead method
par_optimos = fminsearchbnd(fun_objetivo,par0,lb,ub, options);
function FO =FunObjetivo(par,data)
%Time
t = data(:,1);
%Experimental data
xe = data(:,2);
%Constants
cc=0.365851537;
ca0=7.718472259;
keq=3.6021;
Te=323.15;
cs=cc*ca0*
k0=par(1);
Ea=par(2);
k1=k0*exp(-Ea/(8.310*Te));
%Simulation
y0=0;
dxadt=@(t,xa) k1*cs*((1-xa^2)-((xa^2)/keq));
tspan=[0:60:420];
[t,xa]=ode15s(dxadt,tspan,y0);
%FO
FO = sum((xe-xa).^2);
end
  2 个评论
Torsten
Torsten 2023-5-1
But I already explained to you that you cannot estimate Ea from your data because they are measured for a fixed temperature and that the keq you prescribe doesn't conform with your measurements.
So why do you ask the same question again ?
Jorge Armando Vazquez
编辑:Jorge Armando Vazquez 2023-5-1
I obtained the Keq from the thermodynamic data, and it is possible to obtain the activation energy and the ko for the temperature, the k1 is the only one that will vary with the different temperatures

请先登录,再进行评论。

回答(1 个)

Torsten
Torsten 2023-5-1
移动:Torsten 2023-5-1
I obtained the Keq from the thermodynamic data
Then your thermodynamic program gave you the wrong value for Keq for your experimental conditions.
Or your Keq has to be converted from concentrations to mass fractions ( assuming the xe are mass fractions ).
and it is possible to obtain the activation energy and the ko for the temperature, the k1 is the only one that will vary with the different temperatures
Say you obtained separate values for k0 and Ea for your model from the optimization. These two parameters are subsummed in a new parameter k1 = k0*exp(-Ea/(8.310*Te)), and this value is used as a constant in your model since your measurement data don't depend on temperature.
Thus k1 = k0 * C with C = exp(-Ea/(8.310*Te)) being a constant.
Now if you set k0' = k0*p, C' = C/p for an arbitrary paramter p>0, the product k0'*C' will give you the same value for k1 and the same fitting quality for your measurement data. That's why you are "overfitting" if you try to fit k0 and Ea separately in your model. Since you don't have measurement data for different temperatures, exp(-Ea/(8.310*Te)) is a constant in your model - thus you cannot discriminate between contributions to k0 and contributions to C.
Or putting it even easier: The product of two numbers a and b can be written in infinitely many ways.
E.g. 20 = 4*5 = 2*10 = 1*20 = 2.5*8 = ...
If you get 4 and 5 as result, why do you think it should be preferred against 2.5 and 8 ?
  2 个评论
Jorge Armando Vazquez
I know that different values can satisfy the problem but that were the instructions of the proyect ( find ko and Ea with only that information), I just need to make the values converge as well as possible to colloborate the experimental data of an article and in which I only have the conversion equation and the plot of conversion vs time
Torsten
Torsten 2023-5-2
编辑:Torsten 2023-5-2
I said everything that I can contribute: Fitting k0 and Ea independently is nonsense and the value of Keq is inadequate with respect to your experimental data. If you want to do something senseful with your data, you should estimate p1 = k0*exp(-Ea/(8.310*Te))*cs as the first unknown parameter and p2 = Keq as the second.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Thermal Analysis 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by