AIR UNIVERSITY
DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
EXPERIMENT NO 2
Lab Title: Implementing various functions and plotting their graph using MATLAB
Student Name: M Sohaib Khan Reg. No: 230683
Objective:
and implement fundamental digital logic circuits used in arithmetic operations.
LAB ASSESSMENT:
Excellent Good Average Satisfactory Unsatisfactory
Attributes
(5) (4) (3) (2) (1)
Ability to Conduct
Experiment
Ability to assimilate the
results
Effective use of lab
equipment and follows
the lab safety rules
Total Marks: Obtained Marks:
LAB REPORT ASSESSMENT:
Excellent Good Average Satisfactory Unsatisfactory
Attributes
(5) (4) (3) (2) (1)
Data presentation
Experimental results
Conclusion
Total Marks: Obtained Marks:
Date: Signature:
Department of Electrical and Computer Engineering
Numerical Analysis And Computations LAB
Lab Report: 2
Name: M Sohaib Khan
Roll Number: 230683
Class: BCE-4B
Submitted To: Mam Saira Naz
Date: February 26th, 2025
2
Air University, Islamabad Numerical Analysis And Computations Lab
Lab Tasks
Mathematical Functions:
Implement a function using MATLAB that finds the roots of a quadratic equation using the
quadratic formula.
TASK 1
Lab Tasks
Signal Processing Functions:
Implement a function using MATLAB that generates and plots a sine wave with given amplitude
and frequency.
3
TASK 2
Lab Tasks:
Image Processing Functions
Create a MATLAB function that increases the brightness of an image by a given factor.
TASK 3
4
Air University, Islamabad Numerical Analysis And Computations Lab
Data Analysis and Statistics
• Create a MATLAB function that generates a box plot for a given dataset.
• Compare the graphs of h(x) = x5 − x3 + x and p(x) = −x5 + x3 − x on interval [-2,2].
• Graph (x) =x2−4/x−2and discuss any discontinuities.
• Plot g(x) = log10x and h(x) = log2x for x∈[0.1,10].
• Graph h(x) = tanx for x∈[−π,π], highlighting the asymptotes.
• Compare h(x) = tanhx and p(x) = cothx over x∈[−3,3].
TASK 4 Q1
5
TASK 4 Q2
TASK 4 Q3
6
Air University, Islamabad Numerical Analysis And Computations Lab
TASK 4 Q4
TASK 4 Q5
7
Conclusion:
Implementing various functions and plotting their graphs using MATLAB provides a clear
visual understanding of mathematical behavior. It aids in identifying critical points, trends,
and intersections that might not be evident from equations alone. Graphical representation
helps in verifying theoretical predictions and debugging code. MATLAB's robust graphing
tools enable precise and customizable plots. This process enhances learning and
comprehension of mathematical concepts. Overall, MATLAB is an invaluable tool for both
educational and professional applications.