You are on page 1of 2

clc

clear all

%Data t as column 1
Data(1:61,1)=0:60;
%Data Fin as column 2
Data(1:15,2)=2;
Data(16:30,2)=2.25;
Data(31:45,2)=1.75;
Data(46:61,2)=2;
Data(:,2)=Data(:,2)+(2.2-1.8);
% Data q as column 3
Data(1:15,3)=100+(125-75);
Data(16:30,3)=150+(125-75);
Data(31:45,3)=50+(125-75);
Data(46:61,3)=100+(125-75);
tspan=Data(:,1);
ro=1; cp=4.2; q=100;
Tin=30; a=1; A=1;
hin=2; IC=[hin,42];
%Solver
[t, y]=ode15s(@dalpros_1_func,tspan,IC,[],Data,cp,ro,a,A,Tin);
%Plotting
h=y(:,1); T=y(:,2);
figure(1)
subplot(2,1,1)
plot(t,h)
title('Height of Liquid inside of Tank')
xlabel('Time, minute')
ylabel('Height, m')
subplot(2,1,2)
plot(t,T,'r')
title('Temperature inside of Tank')
xlabel('Time, minute')
ylabel('Temperature, \circC')
Published with MATLAB® R2016b

You might also like