clear all;
warning off;

% Load the file data
data=readtable('data_virtual_tank.txt');

% Get the columns

t=table2array(data(:,1));           % time
h1=table2array(data(:,2));          % Height of lower tank
q1=table2array(data(:,3));          % Flow for pump 1
h3=table2array(data(:,4));          % Height of upper tank
q2=table2array(data(:,5));          % Flow for pump 2

% Note: the meaning for the rest of the columns can be found in the first 
% row of the data table.

% Show graphical results

figure
subplot(4,1,1)
plot(t,h1);
ylabel('h_1 (cm)');xlabel('Time (s)');
title('Virtual tank results')
subplot(4,1,2)
plot(t,q1)
ylabel('q_1 (cm^3/s)');xlabel('Time (s)');
subplot(4,1,3)
plot(t,h3)
ylabel('h_3 (cm)');xlabel('Time (s)');
subplot(4,1,4)
plot(t,q2)
ylabel('q_2 (cm^3/s)');xlabel('Time (s)');
