matlab lab 3
matlab lab 3
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
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.
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
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.
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.
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.