function P2_14 clear, clc, format short g, format compact tspan = [0 60.]; % Range for the independent variable y0 = [1000.; 200.]; % Initial values for the dependent variables disp(' Variable values at the initial point '); disp([' t = ' num2str(tspan(1))]); disp(' y dy/dt '); disp([y0 ODEfun(tspan(1),y0)]); [t,y]=ode45(@ODEfun,tspan,y0); for i=1:size(y,2) disp([' Solution for dependent variable y' int2str(i)]); disp([' t y' int2str(i)]); disp([t y(:,i)]); plot(t,y(:,i)); title([' Plot of dependent variable y' int2str(i)]); xlabel(' Independent variable (t)'); ylabel([' Dependent variable y' int2str(i)]); pause end %- - - - - - - - - - - - - - - - - - - - - - function dYfuncvecdt = ODEfun(t,Yfuncvec); M = Yfuncvec(1); S = Yfuncvec(2); SaltPC = 100 * S / M; dMdt = 10; dSdt = 2 - (10 * S / M); dYfuncvecdt = [dMdt; dSdt];