Hello, I am trying to solve these two coupled differential equations, but I can't seem to get it to work. I always have difficulty using ODE45…but why isn't the variable X being recognized? The image shows the differential equations I am trying to solve using MATLAB
alpha = 0.001; % L^-1
FA0 = 2.5; % mol/min
CA0 = 0.305; % mol/L
eps = 2;k = 0.044;CA = @(y,X) CA0*(1-X).*y./(1+eps*X);rA = @(y,X) -k*CA(y,X);vSpan = [0 500]; % L
dXdV = @(V,X) -rA(y,X)/FA0;dydV = @(V,y) -alpha*(1+eps.*X)./(2*y);[V, Y] = ode45(dydV,vSpan,1);[V, X] = ode45(dXdV,vSpan,0);
But this is the error I encounter
Undefined function or variable 'X'.Error in @(V,y)-alpha*(1+eps.*X)./(2*y)Error in odearguments (line 88)f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 114)[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn,...
Best Answer