This lab report summarizes demonstrating various mathematical models through plotting in Octave/Matlab. It plots trigonometric functions like sine and cosine over an angle range from 0 to 2π. It also plots discrete data by defining two time ranges with different functions over each range and combining them. The report concludes that mathematical modeling provides theoretical and analytic insights into systems by giving precision and direction for problem solving.
1. Nepal College of Information Technology
Faculty of Science and Technology
Bachelor of Software Engineering
Lab Report On
Demonstrating Various
Mathematical Models
Candidate name
Nischal Lal Shrestha
Supervised by
Asst. P. Roshan Kumar Shah
February 3, 2019
2. Demonstrating Various Mathematical Models Nischal Lal Shrestha
1 Introduction
Mathematical modeling is the art of translating problems from an application area
into tractable mathematical formulations whose theoretical and numerical analysis
provides insight, answers, and guidance useful for the originating application.
Mathematical Modeling
• is indispensable in many applications.
• is successful in many further applications.
• gives precision and direction for problem solution.
• enables a thorough understanding of the system modeled.
2 Plotting Mathematical Models
We can use tools like Octave or Matlab to plot various mathematical models. By
plotting a mathematical models we can understand the system thoroughly.
2.1 Plotting Trigonometric Functions
1 % Title : Demonstrate Various Mathematical Models
2 % Author : Nischal Lal Shrestha
3 % Date : 6th Jan , 2019
4
5 c l e a r a l l ;
6 c l e a r var iables ;
7 c l c ;
8
9 % x ranges from 0 to 2 pi .
10 x = linspace (0 ,2∗ pi ,100) ;
11
12 y = sin (x) ;
13 z = cos (x) ;
14
15 f i g u r e ;
16
17 hold on ;
18 plot (x , y , ’ r ’ ) ;
19 plot (x , z , ’b ’ ) ;
20 t i t l e ( ’ Trigonometric Functions ’ ) ;
21 xlabel ( ’ angles ’ ) ;
22 ylabel ( ’ Sine and Cosine ’ ) ;
23 legend ( ’ Sine ’ , ’ Cosine ’ ) ;
24 grid on ;
25 hold o f f ;
Page 1
3. Demonstrating Various Mathematical Models Nischal Lal Shrestha
Figure 1: Plotting Sine and Cosine Function
2.2 Plotting Discrete Data Graph
1 % Title : Demonstrate Discrete Data Graph
2 % Author : Nischal Lal Shrestha
3 % Date : 6th Jan , 2019
4
5 c l e a r a l l ;
6 c l e a r var iables ;
7 c l c ;
8
9
10 t1 = linspace (0 , 1 , 100) ;
11 t2 = linspace (1 , 6 , 500) ;
12
13 y1 = t1 ;
14 y2 = 1./ t2 ;
15
16 t = [ t1 , t2 ] ;
17 y = [ y1 , y2 ] ;
18
19 f i g u r e ;
20
21 hold on ;
22 plot ( t , y) ;
23 t i t l e ( ’ Discrete Data Graph ’ ) ;
24
25 grid on ;
26 hold o f f ;
Page 2
4. Demonstrating Various Mathematical Models Nischal Lal Shrestha
Figure 2: Plotting Discrete Data Graph
3 Result, Conclusion and Discussion
In this lab, we have modeled trigonometric functions and discrete data graph. Model-
ing of mathematical theory gave us clear theoretical and analytic insights.
References
[1] MathWorks: Modeling and Simulation
https://www.mathworks.com/discovery/modeling-and-simulation.html
Page 3