I am recieving an error in creating the solution however it still prints a result.
clc
clear all
close all
%Homework 7 Question 3
Tin=298; %K
Cp=80; %J/(mol K)
CAin=2000; %mol/m^3
k0=10e-7; %m3/(mol min)
Ea_R=5000; %K
rho=1000; %mol/m^3
CA=linspace(2,2000,61);
xA=(CAin-CA)/CAin;
T_sol=zeros(1,length(CA));
k_sol=zeros(1,length(CA));
tau_sol=zeros(1,length(CA));
DHR=-50000; %J/mol exothermic (gets hot)
for i=1:length(CA)
syms T k tau
eqn1=k==k0*exp((-Ea_R)*((1/T)-(1/Tin)));
eqn2=2*k*(CA(i)^2)==(CAin-CA(i))/tau;
eqn3=k*tau*(CA(i))^2*DHR==rho*Cp*(Tin-T);
solution=solve([eqn1,eqn2,eqn3],[T,k,tau]);
T_sol(i)=double(solution.T);
k_sol(i)=double(solution.k);
tau_sol(i)=double(solution.tau);
end
figure(1)
plot(log10(tau_sol),xA,’-bo’);
xlabel(‘log_{10}(tau, min)’)
ylabel(‘x_A’)clc
clear all
close all
%Homework 7 Question 3
Tin=298; %K
Cp=80; %J/(mol K)
CAin=2000; %mol/m^3
k0=10e-7; %m3/(mol min)
Ea_R=5000; %K
rho=1000; %mol/m^3
CA=linspace(2,2000,61);
xA=(CAin-CA)/CAin;
T_sol=zeros(1,length(CA));
k_sol=zeros(1,length(CA));
tau_sol=zeros(1,length(CA));
DHR=-50000; %J/mol exothermic (gets hot)
for i=1:length(CA)
syms T k tau
eqn1=k==k0*exp((-Ea_R)*((1/T)-(1/Tin)));
eqn2=2*k*(CA(i)^2)==(CAin-CA(i))/tau;
eqn3=k*tau*(CA(i))^2*DHR==rho*Cp*(Tin-T);
solution=solve([eqn1,eqn2,eqn3],[T,k,tau]);
T_sol(i)=double(solution.T);
k_sol(i)=double(solution.k);
tau_sol(i)=double(solution.tau);
end
figure(1)
plot(log10(tau_sol),xA,’-bo’);
xlabel(‘log_{10}(tau, min)’)
ylabel(‘x_A’) clc
clear all
close all
%Homework 7 Question 3
Tin=298; %K
Cp=80; %J/(mol K)
CAin=2000; %mol/m^3
k0=10e-7; %m3/(mol min)
Ea_R=5000; %K
rho=1000; %mol/m^3
CA=linspace(2,2000,61);
xA=(CAin-CA)/CAin;
T_sol=zeros(1,length(CA));
k_sol=zeros(1,length(CA));
tau_sol=zeros(1,length(CA));
DHR=-50000; %J/mol exothermic (gets hot)
for i=1:length(CA)
syms T k tau
eqn1=k==k0*exp((-Ea_R)*((1/T)-(1/Tin)));
eqn2=2*k*(CA(i)^2)==(CAin-CA(i))/tau;
eqn3=k*tau*(CA(i))^2*DHR==rho*Cp*(Tin-T);
solution=solve([eqn1,eqn2,eqn3],[T,k,tau]);
T_sol(i)=double(solution.T);
k_sol(i)=double(solution.k);
tau_sol(i)=double(solution.tau);
end
figure(1)
plot(log10(tau_sol),xA,’-bo’);
xlabel(‘log_{10}(tau, min)’)
ylabel(‘x_A’) error, chemical reactor MATLAB Answers — New Questions