I know how to solve ODE with const Temperature, but with temperature range I find it difficult to solve.
function dYdt = odereal2(t,Yf); CA = Yf(1); CB = Yf(2); T = 335.32; %just assumed the constant temperature.
k1 = 4000*exp(-2500/T); k2 = 620000*exp(-5000/T); dCAdt = -k1*CA^2; dCBdt = k1*CA^2-k2*CB; dYdt = [dCAdt; dCBdt;];
This is my function that includes Derivative equation.
tspan = [0 3]; C0 = [1.; 0]; [t,C]=ode45(@odereal2,tspan,C0); for i=1:size(C,2) plot(t,C,'pr') %from that plot we can infer the maximum yield of product B
axis([0 3 0 1]) title(' Plot of concentration(C) profiles at optimal residence time' ); xlabel(' Time (hr)'); ylabel(' Concentration (C)'); pause end
And here is my ODE solver code. I just want to find the optimum temperature when concentration of product B reaches the maximum.
Kindly help me in this problem. Thanks in advance
Best Answer