My group and I are trying to come up with code to finish out our MatLab project. I attached the code we have so far and images of the equations we are using to do so. We are attempting to do it with finite difference and ODE solvers as our professor suggested We are running into errors in the code and we cannot quite figure out what is wrong. Any advice, guidance, or fixtures would be greatly appreciated. Thank you in advance. enter image description hereenter image description here
This is the code we have been trying:
`tf=3000;
dt=3000/200;
tspan=0:dt:tf; % creates array for length of time
cf=0.015; %initial concentration
nz=200;
np=nz+1;
Cb=zeros(np,1); Cb(1)=cf;
Cp=zeros(np,1);
C0=[Cb;Cp]; % this may need some adjusting, im not sure if this comes out right
% I beleive this establishes the things for the ODE solver
% following the ode solver, the plots are created
% then a function is created for rates that is then recalled in ode solver
% then a for loop to establish the rest of the equations
A_in=input("Input a value for A_in:")
if (A_in>0)&&(A_in<1)
disp(A_in)
else
disp('Invalid value for inlet concentration')
end
K=input('Enter a value for the rate constant:')
q_o=input('Enter a value for the total exchange capacity of the system:')
k=0.001
function dq/dt=
L=10; % meters
K=0.001;
%A=0:0.01:A_in;
%Ac=A/A_in;
V=0.001;
t=L/V;
delta=tspan./t;
Da=k*A_in*t;
dqdt=zeros(np,1);
s=q_o/A_in;
x=0:0.01:10;0.3
X=x./L;
dq/dt==k[A(q0-q)-q/K(A_in-A)]
dA/dt+v(dA/dx)==-(q0/A_in)*(dq/dt)
%0 == X(1) < X(2) < ... < X(n) = 1
%equ=@(q,A)[dA/dt,dq/dt]
%[q,A]=ode15s(equ,tspan,C0)`