>> %Driver Program to solve the function in tutorial
% set the initial conditions y0=[0 1035]; % set the span for the independent vector txspan=[0 0.001]; % call the ODE solver [V,y]=ode45(@myode1,txspan,y0); %PLOT fractional conversion vs. V plot(V,y(:,1),'*-') xlabel('Volume of reactor'); ylabel('Fractional Conversion'); %PLOT temperature variation vs. V figure plot(V,y(:,2),'+-') xlabel('Volume of reactor'); ylabel('Temperature Variation'); % myode1.m % funtion to evaluate the rhs function F=myode1(V,y) X=y(1);% set the X variable T=y(2);% set the T variable k=exp(34.34-(34222/T));% rate constant Tamb=1150;% surrounding temperature UA=16500;% heat exchange coefficient FA0=0.038314; %feed rate to 1 tube CA0=18.826;% initial concentration of A T0=1035;%intial temperature % Heat capacity: CpA=26.63+(0.183*T)-(45.86*10^(-6))*(T^2); CpB=20.04+(0.0945*T)-(30.95*10^(-6))*(T^2); CpC=13.39+(0.077*T)-(18.71*10^(-6))*(T^2); % Heat of reaction Hr=80.77*1000+6.8*(T-298)-0.00575*((T^2)-(298^2))-(19/15)*(10^(-6))*((T^3)(298^3)); % Rate of reaction( decomposion of A) RA=-k*CA0*(1-X)*(T0/T)/(1+X); F(1)=-RA/FA0; F(2)=(UA*(Tamb-T)+RA*Hr)/(FA0*(CpA+(CpB+CpC-CpA)*X)); F=F';% make sure F is a column end