clc; clear all; close all; % Reactor semibatch con reacción A --> B k = 1; % min-1 function y = semibatch(t,x,v,k,Cain) V = x(1); Ca = x(2); dVdt = v; dVCadt = -k*V*Ca + v*Cain; dCadt = (dVCadt - Ca*dVdt)/V; y = [dVdt dCadt]; endfunction v = input('v entrada = '); Cain = input('Cain = '); Vo = 1 ;% L Cao = 1 ;% concentración inicial, mol/L xo = [Vo Cao]'; tiempos=0:0.1:10; x = lsode(@(x,t) semibatch(t,x,v,k,Cain),xo,tiempos); subplot(2,1,1) plot(tiempos,x(:,1)) xlabel('tiempo (min)') ylabel('volumen (L)') subplot(2,1,2) plot(tiempos,x(:,2)) xlabel('tiempo (min)') ylabel('Ca (mol/L)')