numerical analysis term project_yash_ravi_final report
TRANSCRIPT
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
1/31
NUMERICAL ANALYSIS TERM PROJECT:
YASH SHAH 9003001
RAVI AGARWAL 9003017
PROJECT: SOLVING DIFFERENTIAL EQUATIONS FOR HEAT RECOVERY
SYSTEM GENERATOR USING MATLAB
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
2/31
DESCRIPTION OF HEAT RECOVERY STEAM GENERATOR:
Heat Recovery Steam Generator (HRSG) is used to produce steam by using the waste heatproduced by a gas turbine or some processes where heat is a by-product.
The steam produced in the HRSG can be used to generate power (electrical or mechanical orboth) or it can be directly fed into some process where steam is required as input.
Because of better utilization of energy, the efficiency of the process increases with the useof HRSG.
Lumped Element Analysis:
We have taken Lumped parameters while dealing with the differentia equations of the system.
Discrete entities that approximate the behaviour of the distributed system under certainassumptions. Average values are taken over the system.
Mathematical models are developed for different HRSG components, using lumpedparameter, time dependent, mass and energy balances, with suitable simplifying
assumptions.
The system is linearised about a steady-state operating point. An optimal linear-quadraticregulator (Belanger, 1993) for this system is designed by choosing a suitable performance
index.
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
3/31
CIRCUIT DIAGRAM OF HRSG:
IMPORTANT COMPONENTS OF HRSG:
1. EVAPORATOR2. ECONOMISER3. SUPERHEATER 14. SUPERHEATER 2
The system of equations has been linearised to 10 linear equations with 10 variables.
These are equations are linearised and there are 10 dependent variables
VARIABLES:
1. Evaporator (T1, h1)2. Economiser (T2, h2)3. Superheater 1 (T3, h3)4. Superheater 2 (T4, h4)5. Density of the fluid g6. Volume of the liquid
And one independent variable t.
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
4/31
CONSTANTS:
1. Cd is the coefficient of discharge of the turbine inlet valve.2. Wd is the flow rate of cold fluid passing through the system3. Watt is the flow rate of the fluid in attemperator
The 10 differential equations are:
All the variables in this system of equations indicate the change in parameter(and not the value of
the parameter) at different time periods.
BOUNDARY CONDITION: At the steady state all these variables are zero.
1 = -0.157*T1+0.142*h1;
1 = -0.00114-0.048h1+0.051*T1;
2 = -0.090*T2+0.017*g;
2= -0.00312*h2+1.48*T2+0.00337*T1-0.279*g;
=0.00411;
g =0.0038-0.395*g+0.0374;
3 =-0.037*T3+0.069*h3+0.00672*g;
3 =-0.28*h3 +0.024*h2-0.0134*h1+0.128*T3-0.01*g+0.000642;
4 =-0.037*T4+0.094*h4+0.0036*g;
4 =0.032*h3-0.022*h2+0.012*h1-0.57*h4+0.212*T4-
0.00638*g+0.000382+0.000255
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
5/31
EXPERIMENTAL PROCEDURE:
At t=0 the system is at the steady state, i.e. all the variables are zero We perturbed the system by changing parameters of any one chamber from the steady state
and then observe the system at different time intervals.
The deviations in each of these variables are obtained by solving the system of these 10equations by Runge-Kutta method (we have propose)
Graphs are plotted between various dependent and independent-dependent variables andthe behaviour of the whole system is studied.
ALGORITHM:
Runge-Kutta Method:
4th
order RK Method has been used for the system of 10 equations to get the required results
10 variables:
All these variables refer to the above mentioned Variables respectively.
1. a(1,i)2. a(2i)3. a(3,i)4. a(4,i)5.
a(5,i)
6. a(6,i)7. a(7,i)8. a(8,i)9. a(9,i)10.a(10,i)Here irefer to time instant.
Boundary Condition: All the variables are zero at t=0
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
6/31
One of the chambers parameters (T1 and h1 to start with are given values instead of
zero to analyze its effect on the other variables)
Logic of the Matlab Program:
STEP 1:
A file is made which bears the system of linear equations and is saved as sole.m. This
file is called every time we solve the equations in another file using various numerical
analysis methods.
STEP 2
In a new file we type the syntax to solve the equations after calling the file sole.m
Program Body:
The system is perturbed and the initial values ofTiand hi are changed from zero.
For (j=0; j
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
7/31
For a[i, j], y=i and t=j
General Runge-Kutta Method:
a (i, j+1) = a(i, j) + h/6(k1 + 2k2 + 2k3 + k4) /* herej refers to n in the following formula*/
Example:
In this when we are dealing with a[2,j] only a(2) will be changed and we will take the latest value
(values calculated in the preceding step) of the remaining variables present in the particular
equation.
All the values of p, q, r, s will be found for each variable a[i] at different time intervals depending on
the step size and finally the values of each variable at different time intervals will be found out.
We repeat this method for 4 step sizes: 0.1, 1.0
STEP 3
Step 2 is repeated 3 times by perturbing values of (T2, h2), (T3, h3), (T4, h4) sequentially.
STEP 4
We solve the same set of differential equations using the inbuilt Runge-Kutta function ode45.
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
8/31
STEP 5
We plot the graphs of all the variables versus time for each perturbation
1. (T1, h1)2. (T2, h2),3. (T3, h3),4. (T4, h4)
Syntax:
Plot (0: h: 5, a(: ; : ))
STEP 6
To check the validity of our results we plot values of one variable calculated for different
step sizes and the values obtained using inbuilt function ode45 versus time.
Syntax:
For (i=1; i
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
9/31
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
10/31
Figure 1
Scale:
X-axis: 1 unit = 0.5 seconds
Y-axis: 1 unit = 2 Degree Celsius/ 2 Joules
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
11/31
Case 2:
Change in the temperature (T2) and enthalpy (h2) of the Economiser
Conclusions:
a. Temperature of the Economiser starts decreasing once it is disturbed and it alsoaffects the temperature (T1) of the Evaporator (decreases)
b. Enthalpy of the Economic increases once it is disturbed and it affects enthalpy of theSuperheaters one 1 (increases)&2 (decreases)
c. There is no change in the volume of the drum and density of the fluid
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
12/31
Figure 2
Scale:
X-axis: 1 unit = 0.5 seconds
Y-axis: 1 unit = 10 Degree Celsius/ 10 Joules
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
13/31
Case 3:
Change in the Temperature (T3) and Enthalpy (h3) of the Superheater 1
Conclusions:
a. The temperature of the Superheater 1 keeps on increasing once it is disturbed fromthe equilibrium and the temperature of the other chambers is not affected
b. Enthalpy of the Superheater 1 keeps on decreasing once it is disturbed and it willalso affect the enthalpy of the Superheater 2 (increases) and enthalpy in chambers is
unaltered
c. There is no change in the volume of the drum and density of the fluid
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
14/31
Figure 3
Scale:
X-axis: 1 unit = 0.5 seconds
Y-axis: 1 unit = 2 Degree Celsius/ 2 Joules
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
15/31
Case 4:
Change in the Temperature (T4) and Enthalpy (h4) of the Superheater 2
Conclusions:
a. Temperature in the Superheater 2 increases once it is disturbed and thetemperatures in the other chambers are unaffected
b. Enthalpy in the Superheater 2 starts decreasing once it is disturbed and the enthalpyin other chambers is not affected.
c. There is no change in the volume of the drum and density of the fluid
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
16/31
Figure 4
Scale:
X-axis: 1 unit = 0.5 seconds
Y-axis: 1 unit = 2 Degree Celsius/ 2 Joules
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
17/31
DISCUSSIONS:
We sincerely thank Professor Dhiren Modi for introducing the concept of Engineering
Projects in this course which motivated us to learn Matlab, helped us to come across
various real life engineering problems and introduced us to the concept of report writing.
Why heat recovery steam generation?
Heat Recovery Steam Generator
We have taken this project from Professor Manmohan Pandey. Two students from IIT
Guwahati have written research paper as their B.Tech Project on HRSG under Prof. Pandeys
guidance. The paper focuses on converting the non-linear equations into dimensionless
linear equations and solving them. After studying the equations an open and closed loop
control systems are generated for the Heat Recovery System Generation.
We wanted to know about the types of B.Tech projects taken by students in other Deemed
Engineering Institutes which would help us in deciding the level of our B.Tech projects twoyears hence. Prof. Pandey introduced us to this project and we were more than happy to go
through it and solve the differential equations and make a beginning on doing projects and
report writing.
Also today Energy Conservation has become very important and almost any power plant,
manufacturing unit, vehicles have systems installed for energy efficiency. Heat Recovery
system generation is one such important system installed in power plants for generating
steam from the waste heat and using it to rotate turbines and generate power. Thus the
installation of the Heat Recovery System Generator (HRSG) is very important in present
power plants to increase the efficiency and from the economic point of view.
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
18/31
Why have we used a multi-step method such as Runge-Kutta method?
General Point of View:
A single-step numerical method has a short memory. The only information passed
From one step to the next is an estimate of the proper step size and, perhaps, the
Value of f (tn; yn) at the point the two steps have in common.
A multistep method has a longer memory. After an initial start-up phase, a pth
-order
multistep method saves up to perhaps a dozen values of the solution, yn-p+1; yn-p+2 upto yn-1;
yn, and uses them all to compute yn+1. In fact, these methods can vary the order p, and the
step size, h.
From our System point of view:
Solving the system of equations we can conclude that our system is in non-equilibrium state.
Thus perturbing one variable leads to either continuous increment or decrement in its value and
other dependent variables values.
During analysis if we get even a slight unwanted change in one of the dependent variables,
the analysis may not be upto the mark.
As we are dealing with huge infrastructure oriented systems like Heat Recovery system
Generator within a power plot it is of utmost importance that we have the most accurate analysis.
As Runge-Kutta method is the most accurate we have studied till date, we have decided to
solve the equations using this method.
Accurate changes in all components of the systems can be calculated using Matlab (for
solving differential equations) upto infinite number of cycles in order to check the behaviour of the
system and take appropriate precautionary measures.
What types of analysis can we obtained by solving such equations using Matlab?
1. Controlled System AnalysisIn our system if equation we have various control variables like Wcold, Cdand Watt.
We can solve all the system of variables by giving different values to these user
controlled variables and find out how can we obtaining a particular behavior of the
system according the ambient conditions.
2. Uncontrolled System AnalysisWe have solved the system of linear equations which in uncontrolled. Changes in all the
user controlled variables are assumed zero. We have analysed how the system behaves
when left open.
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
19/31
3. Dependence of all the variables on each other.a. How will the enthalpy of the Superheater 1 change when its temperature is
changed?
Figure 5
Scale:
X-axis: 1 unit = 0.002 Degree Celsius
Y-axis: 1 unit = 0.01 Joules
b. How will the Water in drum level vary when the temperature and enthalpy ofthe Economiser is changed?
(Refer Figure 1)
c. When the temperature of the economiser is increased by say 100 C, after howmuch time the temperature in the evaporator will reach its maximum rated
value?
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
20/31
4. Behaviour of a particular variable in the system:During perturbation in Case 4, changing the temperature from the steady state, the
temperature shoots up enormously and can be dangerous for the steam plant. This can
be anticipated using Matlab and precaution can be taken at the time of initiation.
(Refer Figure 4)
How can we conclude that our method is correct and all the results we have obtained are
accurate and match the original values?
Below is the graph of all the variables with respect to time when we have perturbed the
system by changing two values T1 and h1.
Each graph has 4 values for the same variables calculated by Runge-Kutta method by varying
the step size
1. h=0.01 variable a(10,501) with colour red2. h=0.05 variable e(10,101) with colour magenta3. h=0.1 variable b(10,51) with colour blue4. h=1 variable c(10,6) with colour green5. By using ode45 variable d with colour black
There are three graphs:
For the following graphs:
For a1, a2, a3, a4
Units: Degree Celsius
For a5, a6, a7, a8
Unit: Joules
For a9
Unit: Kg/m3
For a10
Unit: m3
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
21/31
1. System left open for 5 seconds
FIGURE 6
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
22/31
2. System left open for 15 seconds
FIGURE 7
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
23/31
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
24/31
From the third graph we can conclude that for small interval after the system is left open say 40
seconds, Runge-Kutta method is accurate with the inbuilt function
After 40 seconds, our calculations are accurate as we can see the graphs using different sizes
coincide but it shows variations with the ode45 solutions.
BIBLIOGRAPHY:
PROJECT TAKEN FROM RESEARCH PAPER
BY: AMIT NATH PANDEY AND BHARAT PANDEY
MENTOR: PROF. MANMOHAN PANDEY
http://c/Users/yashshah/Downloads/paper171%20(2).pdfhttp://c/Users/yashshah/Downloads/paper171%20(2).pdfhttp://c/Users/yashshah/Downloads/paper171%20(2).pdf -
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
25/31
APPENDIX:
VARIABLES:
1. T1 =a12. T2 =a23. T3 =a34. T4 =a45. h5 =a56. h6 =a67. h7 =a78. h8 =a89. g =a910.V10out =a10
Matlab Program for the project (The following code gives the graph of FIGURE 6 ,
rest of the graphs are plotted accordingly by changing the initial values as per
mentioned below every graph. Also the function sole is made a separate
function [ da ] = sole( t,a )%UNTITLED Summary of this function goes here% Detailed explanation goes hereda(1)=-0.157* a(2) + 0.142*a(5);
da(5)=-0.00114-0.048*a(5)+0.051*a(1); da(2)=-0.090*a(2)+0.017*a(9);da(6)=-0.00312*a(6)+1.48*a(2)+0.00337*a(1)-0.279*a(9); da(10)=0.00411;da(9)=0.0038-0.395*a(9)+0.0374;da(3)=-0.037*a(3)+0.069*a(7)+0.00672*a(9); da(7)=-0.28*a(7)+0.024*a(6)-0.0134*a(5)+0.128*a(3)-0.01*a(9)+0.000642; da(4)=-0.037*a(4)+0.094*a(8)+0.0036*a(9); da(8)=0.032*a(7)-0.022*a(6)+0.012*a(5)-0.57*a(8)+0.212*a(4)-0.00638*a(9)+0.000382+0.000255;
da = da(:);
end
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
26/31
p=zeros(10,501);q=zeros(10,501);r=zeros(10,501);s=zeros(10,501);a=zeros(10,501);
a(1,1)=10;a(2,1)=0;a(3,1)=0;a(4,1)=0;a(5,1)=10;a(6,1)=0;a(7,1)=0;a(8,1)=0;a(9,1)=0;a(10,1)=0;
for j = 1:500
s(1,j)=-0.157* a(2) + 0.142*a(5);r(1,j)=s(1,j);q(1,j)=r(1,j);p(1,j)=q(1,j);a(1,j+1)=a(1,j)+6*0.01/6*(p(1,j));
s(10,j)=0;r(10,j)=s(10,j);q(10,j)=r(10,j);p(10,j)=q(10,j);a(10,j+1)=a(10,j);
p(2,j)=-0.090*a(2)+0.017*a(9);q(2,j)=-0.090*(a(2)+p(2,j)*0.01/2)+0.017*a(9);
r(2,j)=-0.090*(a(2)+q(2,j)*0.01/2)+0.017*a(9); s(2,j)=-0.090*(a(2)+r(2,j)*0.01)+0.017*a(9); a(2,j+1)=a(2,j)+0.01/6*(p(2,j)+2*q(2,j)+2*r(2,j)+s(2,j));
p(3,j)=-0.037*a(3)+0.069*a(7)+0.00672*a(9); q(3,j)=-0.037*(a(3)+p(3,j)*0.01/2)+0.069*a(7)+0.00672*a(9); r(3,j)=-0.037*(a(3)+q(3,j)*0.01/2)+0.069*a(7)+0.00672*a(9); s(3,j)=-0.037*(a(3)+r(3,j)*0.01)+0.069*a(7)+0.00672*a(9); a(3,j+1)=a(3,j)+0.01/6*(p(3,j)+2*q(3,j)+2*r(3,j)+s(3,j));
p(4,j)=-0.037*a(4)+0.094*a(8)+0.0036*a(9);
q(4,j)=-0.037*(a(4)+p(4,j)*0.01/2)+0.094*a(8)+0.0036*a(9); r(4,j)=-0.037*(a(4)+q(4,j)*0.01/2)+0.094*a(8)+0.0036*a(9); s(4,j)=-0.037*(a(4)+r(4,j)*0.01)+0.094*a(8)+0.0036*a(9); a(4,j+1)=a(4,j)+0.01/6*(p(4,j)+2*q(4,j)+2*r(4,j)+s(4,j));
p(5,j)=-0.048*a(5)+0.051*a(1);q(5,j)=-0.048*(a(5)+p(5,j)*0.01/2)+0.051*a(1); r(5,j)=-0.048*(a(5)+q(5,j)*0.01/2)+0.051*a(1); s(5,j)=-0.048*(a(5)+r(5,j)*0.01)+0.051*a(1); a(5,j+1)=a(5,j) +0.01/6*(p(5,j)+2*q(5,j)+2*r(5,j)+s(5,j));
p(6,j)=-0.00312*a(6)+1.48*a(2)+0.00337*a(1)-0.279*a(9); q(6,j)=-0.00312*(a(6)+p(6,j)*0.01/2)+1.48*a(2)+0.00337*a(1)-
0.279*a(9);
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
27/31
r(6,j)=-0.00312*(a(6)+q(6,j)*0.01/2)+1.48*a(2)+0.00337*a(1)-0.279*a(9);
s(6,j)=-0.00312*(a(6)+r(6,j)*0.01)+1.48*a(2)+0.00337*a(1)-0.279*a(9);
a(6,j+1)=a(6,j)+0.01/6*(p(6,j)+2*q(6,j)+2*r(6,j)+s(6,j));
p(7,j)=-0.28*a(7)+0.024*a(6)-0.0134*a(5)+0.128*a(3)-0.01*a(9); q(7,j)=-0.28*(a(7)+p(7,j)*0.01/2)+0.024*a(6)-0.0134*a(5)+0.128*a(3)-
0.01*a(9);r(7,j)=-0.28*(a(7)+q(7,j)*0.01/2)+0.024*a(6)-0.0134*a(5)+0.128*a(3)-
0.01*a(9);s(7,j)=-0.28*(a(7)+r(7,j)*0.01)+0.024*a(6)-0.0134*a(5)+0.128*a(3)-
0.01*a(9);a(7,j+1)=a(7,j)+0.01/6*(p(7,j)+2*q(7,j)+2*r(7,j)+s(7,j));
p(8,j)=0.032*a(7)-0.022*a(6)+0.012*a(5)-0.57*a(8)+0.212*a(4)-0.00638*a(9);
q(8,j)=0.032*a(7)-0.022*a(6)+0.012*a(5)-0.57*(a(8)+p(8,j)*0.01/2)+0.212*a(4)-0.00638*a(9);
r(8,j)=0.032*a(7)-0.022*a(6)+0.012*a(5)-0.57*(a(8)+q(8,j)*0.01/2)+0.212*a(4)-0.00638*a(9);
s(8,j)=0.032*a(7)-0.022*a(6)+0.012*a(5)-0.57*(a(8)+r(8,j)*0.01)+0.212*a(4)-0.00638*a(9);
a(8,j+1)=a(8,j)+0.01/6*(p(8,j)+2*q(8,j)+2*r(8,j)+s(8,j));
p(9,j)=-0.395*a(9);q(9,j)=-0.395*(a(9)+p(9,j)*0.01/2); r(9,j)=-0.395*(a(9)+q(9,j)*0.01/2); s(9,j)=-0.395*(a(9)+r(9,j)*0.01);a(9,j+1)=a(9,j)+ 0.01/6*(p(9,j)+2*q(9,j)+2*r(9,j)+s(9,j));
end
a
p=zeros(10,51);q=zeros(10,51);r=zeros(10,51);s=zeros(10,51);b=zeros(10,51);
b(1,1)=10;b(2,1)=0;b(3,1)=0;b(4,1)=0;b(5,1)=10;b(6,1)=0;b(7,1)=0;b(8,1)=0;b(9,1)=0;b(10,1)=0;
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
28/31
for j = 1:50
s(1,j)=-0.157* b(2) + 0.142*b(5);r(1,j)=s(1,j);q(1,j)=r(1,j);p(1,j)=q(1,j);
b(1,j+1)=b(1,j)+6*0.1/6*(p(1,j));
s(10,j)=0;r(10,j)=s(10,j);q(10,j)=r(10,j);p(10,j)=q(10,j);b(10,j+1)=b(10,j);
p(2,j)=-0.090*b(2)+0.017*b(9);q(2,j)=-0.090*(b(2)+p(2,j)*0.1/2)+0.017*b(9); r(2,j)=-0.090*(b(2)+q(2,j)*0.1/2)+0.017*b(9); s(2,j)=-0.090*(b(2)+r(2,j)*0.1)+0.017*b(9); b(2,j+1)=b(2,j)+0.1/6*(p(2,j)+2*q(2,j)+2*r(2,j)+s(2,j));
p(3,j)=-0.037*b(3)+0.069*b(7)+0.00672*b(9); q(3,j)=-0.037*(b(3)+p(3,j)*0.1/2)+0.069*b(7)+0.00672*b(9); r(3,j)=-0.037*(b(3)+q(3,j)*0.1/2)+0.069*b(7)+0.00672*b(9); s(3,j)=-0.037*(b(3)+r(3,j)*0.1)+0.069*b(7)+0.00672*b(9); b(3,j+1)=b(3,j)+0.1/6*(p(3,j)+2*q(3,j)+2*r(3,j)+s(3,j));
p(4,j)=-0.037*b(4)+0.094*b(8)+0.0036*b(9); q(4,j)=-0.037*(b(4)+p(4,j)*0.1/2)+0.094*b(8)+0.0036*b(9); r(4,j)=-0.037*(b(4)+q(4,j)*0.1/2)+0.094*b(8)+0.0036*b(9); s(4,j)=-0.037*(b(4)+r(4,j)*0.1)+0.094*b(8)+0.0036*b(9); b(4,j+1)=b(4,j)+0.1/6*(p(4,j)+2*q(4,j)+2*r(4,j)+s(4,j));
p(5,j)=-0.048*b(5)+0.051*b(1);q(5,j)=-0.048*(b(5)+p(5,j)*0.1/2)+0.051*b(1); r(5,j)=-0.048*(b(5)+q(5,j)*0.1/2)+0.051*b(1); s(5,j)=-0.048*(b(5)+r(5,j)*0.1)+0.051*b(1); b(5,j+1)=b(5,j) +0.1/6*(p(5,j)+2*q(5,j)+2*r(5,j)+s(5,j));
p(6,j)=-0.00312*b(6)+1.48*b(2)+0.00337*b(1)-0.279*b(9); q(6,j)=-0.00312*(b(6)+p(6,j)*0.1/2)+1.48*b(2)+0.00337*b(1)-
0.279*b(9);r(6,j)=-0.00312*(b(6)+q(6,j)*0.1/2)+1.48*b(2)+0.00337*b(1)-
0.279*b(9);s(6,j)=-0.00312*(b(6)+r(6,j)*0.1)+1.48*b(2)+0.00337*b(1)-0.279*b(9);
b(6,j+1)=b(6,j)+0.1/6*(p(6,j)+2*q(6,j)+2*r(6,j)+s(6,j));
p(7,j)=-0.28*b(7)+0.024*b(6)-0.0134*b(5)+0.128*b(3)-0.01*b(9); q(7,j)=-0.28*(b(7)+p(7,j)*0.1/2)+0.024*b(6)-0.0134*b(5)+0.128*b(3)-
0.01*b(9);r(7,j)=-0.28*(b(7)+q(7,j)*0.1/2)+0.024*b(6)-0.0134*b(5)+0.128*b(3)-
0.01*b(9);s(7,j)=-0.28*(b(7)+r(7,j)*0.1)+0.024*b(6)-0.0134*b(5)+0.128*b(3)-
0.01*b(9);b(7,j+1)=b(7,j)+0.1/6*(p(7,j)+2*q(7,j)+2*r(7,j)+s(7,j));
p(8,j)=0.032*b(7)-0.022*b(6)+0.012*b(5)-0.57*b(8)+0.212*b(4)-0.00638*b(9);
q(8,j)=0.032*b(7)-0.022*b(6)+0.012*b(5)-0.57*(b(8)+p(8,j)*0.1/2)+0.212*b(4)-0.00638*b(9);
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
29/31
r(8,j)=0.032*b(7)-0.022*b(6)+0.012*b(5)-0.57*(b(8)+q(8,j)*0.1/2)+0.212*b(4)-0.00638*b(9);
s(8,j)=0.032*b(7)-0.022*b(6)+0.012*b(5)-0.57*(b(8)+r(8,j)*0.1)+0.212*b(4)-0.00638*b(9);
b(8,j+1)=b(8,j)+0.1/6*(p(8,j)+2*q(8,j)+2*r(8,j)+s(8,j));
p(9,j)=-0.395*b(9);q(9,j)=-0.395*(b(9)+p(9,j)*0.1/2);r(9,j)=-0.395*(b(9)+q(9,j)*0.1/2);s(9,j)=-0.395*(b(9)+r(9,j)*0.1);b(9,j+1)=b(9,j)+ 0.1/6*(p(9,j)+2*q(9,j)+2*r(9,j)+s(9,j));
end
b
p=zeros(10,6);q=zeros(10,6);r=zeros(10,6);s=zeros(10,6);c=zeros(10,6);
c(1,1)=10;c(2,1)=0;c(3,1)=0;c(4,1)=0;c(5,1)=10;c(6,1)=0;c(7,1)=0;c(8,1)=0;c(9,1)=0;c(10,1)=0;
for j = 1:5
s(1,j)=-0.157* c(2) + 0.142*c(5);r(1,j)=s(1,j);q(1,j)=r(1,j);p(1,j)=q(1,j);c(1,j+1)=c(1,j)+4/6*(p(1,j));
s(10,j)=0;r(10,j)=s(10,j);q(10,j)=r(10,j);p(10,j)=q(10,j);
p(2,j)=-0.090*c(2)+0.017*c(9);
q(2,j)=-0.090*(c(2)+p(2,j)*1/2)+0.017*c(9); r(2,j)=-0.090*(c(2)+q(2,j)*1/2)+0.017*c(9); s(2,j)=-0.090*(c(2)+r(2,j)*1)+0.017*c(9);
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
30/31
c(2,j+1)=c(2,j)+1/6*(p(2,j)+q(2,j)+r(2,j)+s(2,j));
p(3,j)=-0.037*c(3)+0.069*c(7)+0.00672*c(9); q(3,j)=-0.037*(c(3)+p(3,j)*1/2)+0.069*c(7)+0.00672*c(9); r(3,j)=-0.037*(c(3)+q(3,j)*1/2)+0.069*c(7)+0.00672*c(9); s(3,j)=-0.037*(c(3)+r(3,j)*1)+0.069*c(7)+0.00672*c(9);
c(3,j+1)=c(3,j)+1/6*(p(3,j)+q(3,j)+r(3,j)+s(3,j));
p(4,j)=-0.037*c(4)+0.094*c(8)+0.0036*c(9); q(4,j)=-0.037*(c(4)+p(4,j)*1/2)+0.094*c(8)+0.0036*c(9); r(4,j)=-0.037*(c(4)+q(4,j)*1/2)+0.094*c(8)+0.0036*c(9); s(4,j)=-0.037*(c(4)+r(4,j)*1)+0.094*c(8)+0.0036*c(9); c(4,j+1)=c(4,j)+1/6*(p(4,j)+q(4,j)+r(4,j)+s(4,j));
p(5,j)=-0.048*c(5)+0.051*c(1);q(5,j)=-0.048*(c(5)+p(5,j)*1/2)+0.051*c(1); r(5,j)=-0.048*(c(5)+q(5,j)*1/2)+0.051*c(1); s(5,j)=-0.048*(c(5)+r(5,j)*1)+0.051*c(1); c(5,j+1)=c(5,j) +1/6*(p(5,j)+q(5,j)+r(5,j)+s(5,j));
p(6,j)=-0.00312*c(6)+1.48*c(2)+0.00337*c(1)-0.279*c(9); q(6,j)=-0.00312*(c(6)+p(6,j)*1/2)+1.48*c(2)+0.00337*c(1)-0.279*c(9); r(6,j)=-0.00312*(c(6)+q(6,j)*1/2)+1.48*c(2)+0.00337*c(1)-0.279*c(9); s(6,j)=-0.00312*(c(6)+r(6,j)*1)+1.48*c(2)+0.00337*c(1)-0.279*c(9); c(6,j+1)=c(6,j)+1/6*(p(6,j)+q(6,j)+r(6,j)+s(6,j));
p(7,j)=-0.28*c(7)+0.024*c(6)-0.0134*c(5)+0.128*c(3)-0.01*c(9); q(7,j)=-0.28*(c(7)+p(7,j)*1/2)+0.024*c(6)-0.0134*c(5)+0.128*c(3)-
0.01*c(9);r(7,j)=-0.28*(c(7)+q(7,j)*1/2)+0.024*c(6)-0.0134*c(5)+0.128*c(3)-
0.01*c(9);s(7,j)=-0.28*(c(7)+r(7,j)*1)+0.024*c(6)-0.0134*c(5)+0.128*c(3)-
0.01*c(9);c(7,j+1)=c(7,j)+1/6*(p(7,j)+q(7,j)+r(7,j)+s(7,j));
p(8,j)=0.032*c(7)-0.022*c(6)+0.012*c(5)-0.57*c(8)+0.212*c(4)-0.00638*c(9);
q(8,j)=0.032*c(7)-0.022*c(6)+0.012*c(5)-0.57*(c(8)+p(8,j)*1/2)+0.212*c(4)-0.00638*c(9);
r(8,j)=0.032*c(7)-0.022*c(6)+0.012*c(5)-0.57*(c(8)+q(8,j)*1/2)+0.212*c(4)-0.00638*c(9);
s(8,j)=0.032*c(7)-0.022*c(6)+0.012*c(5)-0.57*(c(8)+r(8,j)*1)+0.212*c(4)-0.00638*c(9);
c(8,j+1)=c(8,j)+1/6*(p(8,j)+q(8,j)+r(8,j)+s(8,j));
p(9,j)=-0.395*c(9);q(9,j)=-0.395*(c(9)+p(9,j)*1/2);r(9,j)=-0.395*(c(9)+q(9,j)*1/2);s(9,j)=-0.395*(c(9)+r(9,j)*1);c(9,j+1)=c(9,j)+ 1/6*(p(9,j)+q(9,j)+r(9,j)+s(9,j));
end
t = 0:.01:5;t_1 = 0:.1:5;t_2 = 0:5;
c
-
8/4/2019 Numerical Analysis Term Project_yash_ravi_final Report
31/31
ic = [10 0 0 0 10 0 0 0 0 0];[T,d] = ode45(@sole,[0:1:5], ic)AF = d(6,:)d=d';
figure
for i= 1:10subplot(5,2,i)hold onplot(t,a(i,:),'r')plot(t_1,b(i,:),'b')plot(t_2,c(i,:),'g')plot(t_2,d(i,:),'k')xlabel('time(sec)')legend(strcat('a(',num2str(i),')'),strcat('b(',num2str(i),')'),strcat('c(',num2str(i),')'),strcat('d(',num2str(i),')'))hold off
end