Function Global: X Which Maximizes The

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

50288-22-10E AID: 59493 | 29/10/2017

Consider the reaction model.


dx1
k10 x1e E1 RT
dt
dx2
k10 x1e E1 RT k20 x2e E2 RT
dt

Using MATLAB ode45 command, the differential equation is solved to determine the
constant temperature

Consider the following MATLAB function for differential equation.

function ds_dt=conv(val,s)
global T_op
ds_dt(1,1)=-1.335e10*s(1)*exp(-75000/(8.31*T_op));
ds_dt(2,1)=1.335e10*s(1)*exp(-75000/(8.31*T_op)) -
1.149e17*s(2)*exp(-125000/(8.31*T_op));

Consider the following MATLAB function for the value of x2 which maximizes the
amount of B.

function s2=final(T)
global T_op
T_op=T;
s_0=[0.7,0];
[val, s] = ode45('conv', [0 8], s_0 );
s2=-(s(length(s),2));

Consider the following MATLAB program to determine the value of x2 .

[T,negative_s2max]=fminsearch('final', T0)

Consider the MATLAB output.

T0 =

357.8385

Type final(357.8).

ans =

-0.3627

The constant temperature is 357.8 K to maximize the amount of B at x2 0.3627 .

Consider the expression of temperature as cubic function of time


T t a0 a1t a2t 2 a3t 3

Consider the MATLAB function for differential equation

function ds_dt=conv2(val,s)
global a0 a1 a2 a3
T_op=a0+ a1*time_row + a2*time_row^2 + a3*time_row^3;
ds_dt(1,1)=-1.335e10*s(1)*exp(-75000/(8.31*T_op));
ds_dt(2,1)=1.335e10*s(1)*exp(-75000/(8.31*T_op)) -
1.149e17*s(2)*exp(-125000/(8.31*T_op));

Consider the MATLAB function for the value of x2 which maximizes the amount of B.

function s2b=final2(a)
global a0 a1 a2 a3
a0=a(1);a1=a(2);a2=a(3);a3=a(4);s_0=[0.7,0];
[val, s] = ode45('conv2',[0 8],s_0 );
s2b=-s(length(s),2);

Consider the following MATLAB program to determine the optimum temperature.

T,negative_s2max]=fminsearch('final2', ao)

Consider the MATLAB output.

a0 =

372.78
a1 =

-10.44
a2

=2.0217
a3

=-0.1316

Type final2(372.78).

ans =

-0.3699
a0 372.78
a1 10.44
Thus, the values maximize the amount of B at x2 0.3699 .
a2 2.0217
a3 0.1316

You might also like