lab_1dip[1]
lab_1dip[1]
Lab Report 01
Submitted By:
Section B
Submitted To:
Ms. Syeda Aimal Fatima
Department of Computer Science HITEC University Taxila
Write MATLAB command/commands to compute the factorial of 7, 6 using fact().
Write MATLAB command/commands to compute the cosine and sine of the angle 45
where 45 is in degrees.
njkajk
Explanation
In this lab exercise, we utilized MATLAB to perform a variety of mathematical operations,
demonstrating its capabilities in numerical computation. The tasks included calculating factorials,
evaluating trigonometric functions, and executing basic arithmetic operations.
1. Factorials: We computed the factorial of integers using the factorial() function, which is
fundamental in combinatorial mathematics and probability theory.
2. Trigonometric Functions: We distinguished between degrees and radians when
calculating trigonometric values. The cosd() and sind() functions were used for angles in
degrees, while cos() and tan() were employed for angles in radians. This distinction is
essential, as the input format directly influences the output.
3. Arithmetic Operations: We performed basic arithmetic calculations, showcasing
MATLAB's efficiency in handling straightforward mathematical expressions.
4. Variable Assignment and Expressions: We assigned values to variables and evaluated
algebraic expressions, illustrating MATLAB's proficiency in symbolic computation and
variable manipulation.
Conclusion
This lab demonstrated the versatility and power of MATLAB for performing a wide range of
mathematical operations. By computing factorials, evaluating trigonometric functions, and
executing arithmetic calculations, we gained practical experience in using MATLAB for numerical
analysis. The ability to differentiate between degrees and radians in trigonometric calculations is
particularly important in ensuring accurate results. Overall, this exercise reinforced our
understanding of MATLAB as a valuable tool for mathematical computation and analysis.