0% found this document useful (0 votes)
35 views7 pages

Function

The document presents the results of using the Runge-Kutta method to model the liquid levels over time in two interconnected tanks. The model is initialized with starting liquid heights and simulated over a period of 15 minutes in increments of 0.1 minutes. The simulation results show the liquid heights in both tanks gradually increasing over time as liquid flows between the tanks, with the heights leveling off as they approach an equilibrium. Charts are displayed of height vs time for each tank.

Uploaded by

Rohit Kalyan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views7 pages

Function

The document presents the results of using the Runge-Kutta method to model the liquid levels over time in two interconnected tanks. The model is initialized with starting liquid heights and simulated over a period of 15 minutes in increments of 0.1 minutes. The simulation results show the liquid heights in both tanks gradually increasing over time as liquid flows between the tanks, with the heights leveling off as they approach an equilibrium. Charts are displayed of height vs time for each tank.

Uploaded by

Rohit Kalyan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

function​ nonint

clear ​all
clc
h = 0.1;
sc = 15;
n = sc/h;
h1(1) = 4.5;
h2(1) = 4;
t(1)= 0;
for​ i = 1:n
t(i+1) = t(i)+h;
p1=h*nonint1(t(i),h1(i));
p2=h*nonint1(t(i)+(h/2),h1(i)+(p1/2));
p3=h*nonint1(t(i)+(h/2),h1(i)+(p2/2));
p4=h*nonint1(t(i)+h,h1(i));
h1(i+1)=h1(i)+((p1+(2*p2)+(2*p3)+p4)/6);
m1=h*nonint2(t(i),h1(i),h2(i));
m2=h*nonint2(t(i)+(h/2),h1(i)+(p1/2),h2(i)+(m1/2));
m3=h*nonint2(t(i)+(h/2),h1(i)+(p2/2),h2(i)+(m2/2));
m4=h*nonint2(t(i)+h,h1(i)+p3,h2(i)+m3);
h2(i+1)=h2(i)+((m1+(2*m2)+(2*m3)+m4)/6);
end
disp(​' Time,min Height 1,ft Height 2,ft '​)
disp([t;h1;h2]')
subplot(2,1,1);plot(t,h1);
title(​'Variation of the liquid levels w.r.t time in the two tanks non
interacting system using Runge Kutta method'​)
xlabel(​'Time,min'​)
ylabel(​'Height 1,ft'​)
subplot(2,1,2);plot(t,h2);
xlabel(​'Time,min'​)
ylabel(​'Height 2,ft'​)
function​ adot = nonint1(t,h1)
q = 5;
r1 = 1;
q1 = (h1)/r1;
dh1dt = q-q1;
adot =[dh1dt];
function​ cdot = nonint2(t,h1,h2)
r1 = 1;
q1 = (h1)/r1;
r2 = 1;
q2 = (h2/r2);
dh2dt = q1-q2;
cdot = [dh2dt];
Time,min Height 1,ft Height 2,ft

0 4.5000 4.0000

0.1000 4.5484 4.0499

0.2000 4.5921 4.0995

0.3000 4.6315 4.1483

0.4000 4.6672 4.1960

0.5000 4.6994 4.2424

0.6000 4.7285 4.2873

0.7000 4.7547 4.3305

0.8000 4.7785 4.3720

0.9000 4.7999 4.4118

1.0000 4.8193 4.4496

1.1000 4.8367 4.4856

1.2000 4.8525 4.5198

1.3000 4.8668 4.5522

1.4000 4.8797 4.5827

1.5000 4.8913 4.6116

1.6000 4.9018 4.6387

1.7000 4.9113 4.6642

1.8000 4.9199 4.6881

1.9000 4.9277 4.7106

2.0000 4.9347 4.7316

2.1000 4.9410 4.7512

2.2000 4.9467 4.7695

2.3000 4.9519 4.7866

2.4000 4.9565 4.8026

2.5000 4.9607 4.8174

2.6000 4.9645 4.8313


2.7000 4.9680 4.8441

2.8000 4.9711 4.8560

2.9000 4.9739 4.8671

3.0000 4.9764 4.8774

3.1000 4.9787 4.8869

3.2000 4.9807 4.8958

3.3000 4.9826 4.9039

3.4000 4.9843 4.9115

3.5000 4.9858 4.9185

3.6000 4.9872 4.9250

3.7000 4.9884 4.9310

3.8000 4.9895 4.9365

3.9000 4.9905 4.9416

4.0000 4.9915 4.9463

4.1000 4.9923 4.9506

4.2000 4.9930 4.9546

4.3000 4.9937 4.9583

4.4000 4.9943 4.9617

4.5000 4.9949 4.9648

4.6000 4.9954 4.9677

4.7000 4.9958 4.9704

4.8000 4.9962 4.9728

4.9000 4.9966 4.9751

5.0000 4.9969 4.9771

5.1000 4.9972 4.9790

5.2000 4.9975 4.9808

5.3000 4.9977 4.9824

5.4000 4.9979 4.9838


5.5000 4.9981 4.9852

5.6000 4.9983 4.9864

5.7000 4.9985 4.9876

5.8000 4.9986 4.9886

5.9000 4.9988 4.9896

6.0000 4.9989 4.9905

6.1000 4.9990 4.9913

6.2000 4.9991 4.9920

6.3000 4.9992 4.9927

6.4000 4.9993 4.9933

6.5000 4.9993 4.9939

6.6000 4.9994 4.9944

6.7000 4.9995 4.9949

6.8000 4.9995 4.9953

6.9000 4.9996 4.9957

7.0000 4.9996 4.9961

7.1000 4.9996 4.9964

7.2000 4.9997 4.9967

7.3000 4.9997 4.9970

7.4000 4.9997 4.9973

7.5000 4.9998 4.9975

7.6000 4.9998 4.9977

7.7000 4.9998 4.9979

7.8000 4.9998 4.9981

7.9000 4.9998 4.9983

8.0000 4.9999 4.9984

8.1000 4.9999 4.9985

8.2000 4.9999 4.9987


8.3000 4.9999 4.9988

8.4000 4.9999 4.9989

8.5000 4.9999 4.9990

8.6000 4.9999 4.9991

8.7000 4.9999 4.9992

8.8000 4.9999 4.9992

8.9000 4.9999 4.9993

9.0000 4.9999 4.9994

9.1000 5.0000 4.9994

9.2000 5.0000 4.9995

9.3000 5.0000 4.9995

9.4000 5.0000 4.9996

9.5000 5.0000 4.9996

9.6000 5.0000 4.9996

9.7000 5.0000 4.9997

9.8000 5.0000 4.9997

9.9000 5.0000 4.9997

10.0000 5.0000 4.9997

10.1000 5.0000 4.9998

10.2000 5.0000 4.9998

10.3000 5.0000 4.9998

10.4000 5.0000 4.9998

10.5000 5.0000 4.9998

10.6000 5.0000 4.9999

10.7000 5.0000 4.9999

10.8000 5.0000 4.9999

10.9000 5.0000 4.9999

11.0000 5.0000 4.9999


11.1000 5.0000 4.9999

11.2000 5.0000 4.9999

11.3000 5.0000 4.9999

11.4000 5.0000 4.9999

11.5000 5.0000 4.9999

11.6000 5.0000 4.9999

11.7000 5.0000 4.9999

11.8000 5.0000 5.0000

11.9000 5.0000 5.0000

12.0000 5.0000 5.0000

12.1000 5.0000 5.0000

12.2000 5.0000 5.0000

12.3000 5.0000 5.0000

12.4000 5.0000 5.0000

12.5000 5.0000 5.0000

12.6000 5.0000 5.0000

12.7000 5.0000 5.0000

12.8000 5.0000 5.0000

12.9000 5.0000 5.0000

13.0000 5.0000 5.0000

13.1000 5.0000 5.0000

13.2000 5.0000 5.0000

13.3000 5.0000 5.0000

13.4000 5.0000 5.0000

13.5000 5.0000 5.0000

13.6000 5.0000 5.0000

13.7000 5.0000 5.0000

13.8000 5.0000 5.0000


13.9000 5.0000 5.0000

14.0000 5.0000 5.0000

14.1000 5.0000 5.0000

14.2000 5.0000 5.0000

14.3000 5.0000 5.0000

14.4000 5.0000 5.0000

14.5000 5.0000 5.0000

14.6000 5.0000 5.0000

14.7000 5.0000 5.0000

14.8000 5.0000 5.0000

14.9000 5.0000 5.0000

15.0000 5.0000 5.0000

>>

You might also like