0% found this document useful (0 votes)
3 views

matlab lab 3

The document outlines two tasks involving MATLAB simulations to analyze reaction rates and numerical methods for finding roots of functions. Task 1 focuses on the Arrhenius equation, demonstrating how temperature affects reaction rates, while Task 2 employs the Bisection and Newton-Raphson methods to find roots of a function's derivative. Results indicate that both numerical methods are effective, with Newton-Raphson converging faster than Bisection, and emphasize the importance of temperature control in chemical kinetics.

Uploaded by

shkbilal6794
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

matlab lab 3

The document outlines two tasks involving MATLAB simulations to analyze reaction rates and numerical methods for finding roots of functions. Task 1 focuses on the Arrhenius equation, demonstrating how temperature affects reaction rates, while Task 2 employs the Bisection and Newton-Raphson methods to find roots of a function's derivative. Results indicate that both numerical methods are effective, with Newton-Raphson converging faster than Bisection, and emphasize the importance of temperature control in chemical kinetics.

Uploaded by

shkbilal6794
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Table of Contents

Task # 1: ......................................................................................................................................2
MATLAB Code .........................................................................................................................2
Results .........................................................................................................................................3
Discussion ....................................................................................................................................3
Conclusion ...................................................................................................................................3
Task # 2 .......................................................................................................................................4
Bisection Method: ........................................................................................................................4
Result ..........................................................................................................................................5
Discussion ....................................................................................................................................6
Conclusion ...................................................................................................................................6
Newton Raphson’s Method ...........................................................................................................6
Result ..........................................................................................................................................7
Discussion ....................................................................................................................................8
Conclusion ...................................................................................................................................8

List of Figures

Figure 1: Output Graph for Task 1 ...................................................................................................3


Figure 2 ; Output Result of Bisection Method ...................................................................................5
Figure 3 ; Graph of Error Vs. Iteration for Bisection Method ..............................................................5
Figure 4 ; Output Result for Newton Raphson's Method .....................................................................7
Figure 5 : Graph of Error Vs. Iteration for Newton Raphson's Method .................................................8
Task # 1:

MATLAB Code
The MATLAB Code for this task is given below:
Results
The MATLAB code in task 1 calculates the reaction rate constant k at different temperatures using
the Arrhenius equation. The results show that as the temperature increases, the reaction rate constantly
increases. This behavior is expected because, according to the Arrhenius equation, higher temperatures
provide more energy for molecules to overcome the activation energy barrier which shows the faster
reaction.

Figure 1: Output Graph for Task 1

Discussion
The plot of k against temperature shows an exponential increase in the reaction rate constant. At
lower temperatures, k is very small, meaning the reaction occurs very slowly. As the temperature rises, k
increases significantly, indicating a faster reaction rate. This trend shows us that temperature has a strong
effect on reaction kinetics.
The exponential relationship between k and temperature follows the Arrhenius law, where the rate
constant depends on the pre-exponential factor A, activation energy E, and the gas constant R. The results
match the theoretical results of chemical kinetics.

Conclusion
The MATLAB simulation explain the effect of temperature on the reaction rate constant using the
Arrhenius equation. The results confirm that increasing temperature will increase the reaction rate due to
higher molecular energy. This study gives importance of temperature control in chemical processes to
optimize reaction rates.
Task # 2
Write a MATLAB script that uses the following two numerical methods (Steven and Raymond, 2022) to
determine the maximum of the above equation: 1. Bisection Method 2. Newton Raphson Method

𝑓(𝑥) = −2𝑥 6 − 1.6𝑥 4 + 12𝑥 + 1

Bisection Method:
For the Bisection method, the MATLAB code is here.
Result
The MATLAB code in task 2 part 1 applies the Bisection Method to find the root of the function's
first derivative. The results show that the method successfully finds a root within the given interval [-2, 2].
The number of iterations depends on the set tolerance value, and the error reduces as the iterations progress.
The final root approximation is displayed after the method meets the required accuracy.

Figure 2 ; Output Result of Bisection Method

Figure 3 ; Graph of Error Vs. Iteration for Bisection Method


Discussion
The Bisection Method is a numerical technique used to find roots of functions. It works by
repeatedly dividing the interval into halves and selecting the subinterval where the root lies. The method
ensures that the function values at the endpoints have opposite signs, which guarantees the presence of a
root.
From the results, the error decreases with each iteration, confirming that the method is converging
toward the correct root. The plot of error vs. iteration shows a decreasing trend, proving that the method
becomes more accurate over time. The number of iterations required depends on the stopping tolerance; a
smaller tolerance leads to more iterations but higher accuracy.

Conclusion
The MATLAB code shows the Bisection Method to find the root of the function’s first
derivative. The results confirm that the method is reliable and ensures gradual error reduction with
each step. This study highlights how numerical methods like the Bisection Method are useful in
solving equations where analytical solutions may not be possible.

Newton Raphson’s Method


The MATLAB Code for the Newton Raphson’s method to find the root of equation is given below.
Result
The MATLAB code applies to the Bisection Method and Newton-Raphson Method to find the root
of the function's first derivative. The results show that both methods successfully find a root within the
given interval. The Bisection Method finds the root through interval reduction, while the Newton-Raphson
Method converges faster by using function derivatives. The number of iterations depends on the tolerance
value, and the error reduces as the iterations progress. The final root approximations for both methods are
displayed after meeting the required accuracy.

Figure 4 ; Output Result for Newton Raphson's Method


Figure 5 : Graph of Error Vs. Iteration for Newton Raphson's Method

Discussion
The Newton-Raphson Method is a faster numerical approach that uses both the first and second
derivatives of a function. It updates the root estimate using tangent line approximations. From the results,
this method converges more quickly compared to the Bisection Method, requiring fewer iterations.
However, if the initial guess is not close to the actual root, it may fail to converge properly.
Both methods show a decreasing trend in error over iterations, demonstrating their effectiveness.
The plots of error vs. iteration confirm that the methods provide accurate results based on the chosen
stopping tolerance.

Conclusion
The MATLAB code successfully implements the Bisection Method and Newton-Raphson Method
to find the root of the function’s first derivative. The results confirm that both methods are reliable, with
the Bisection Method ensuring gradual convergence and the Newton-Raphson Method providing faster
results. This study highlights how numerical methods help solve complex equations where analytical
solutions may not be possible.

You might also like