NAME: PRECIOUS AUGUSTINE NSA

MATRIC NO: 17/ENG08/002

DEPT: BIOMEDICAL ENGINEERING

COURSE CODE: ENG 382

ENGINEERING MATHEMATICS IV

FUNCTION COMMAND

function dqdt = favour(t,q)

dqdt(1)= (-0.03*q(1))+(0.005*q(2))+1;

dqdt(2)= (0.03*q(1))-(0.018*q(2))+(0.0075*q(3));

dqdt(3)= (0.013*q(2))-(0.0325*q(3));

dqdt=dqdt';

end

SIMULATION

commandwindow

clear all

clc

close all

[t,q]= ode45('favour',[0: 45: 1200],[0 0 0]);

figure(1);

subplot(3,1,1)

plot(t,q(:,1),'o-g')

xlabel('Time (min)')

ylabel('Volume(Litre)')

legend('Tank 1')

grid on

grid minor

axis tight

subplot(3,1,2)

plot(t,q(:,2),'*-b')

xlabel('Time (min)')

ylabel('Volume(Litre)')

legend ('Tank 2')

grid on

grid minor

axis tight

subplot(3,1,3)

plot(t,q(:,1),'+-r')

xlabel('Time (min)')

ylabel('Volume(litre)')

legend ('Tank 2')

grid on

grid minor

axis tight