Latex-Report On Exercise 3-1: Using Element-Wise Operations: Alisher Samadov - 001818110 March 2, 2024
Latex-Report On Exercise 3-1: Using Element-Wise Operations: Alisher Samadov - 001818110 March 2, 2024
Latex-Report On Exercise 3-1: Using Element-Wise Operations: Alisher Samadov - 001818110 March 2, 2024
Introduction
In this report, we address Exercise 3-1 which involves the use of element-wise operations in MATLAB.
We create a function named ’ex3p1’ to perform various operations on input arrays [1].
Methods
The ex3p1 function takes a 1x5 array with integers from 6 to 10 as input and generates another 1x5 array
with integers from 1 to 5. Element-wise operations, including addition, subtraction, multiplication, and
division, are performed between the input array (A) and the generated array (B). These operations are
defined as follows:
• Addition: F irst = A + B
• Subtraction: Second = A − B
• Multiplication: T hird = A × B
• Division: F ourth = A
B
Results
Figure 1 shows the results of element-wise operations. Each data point presents an operation between the
corresponding elements of the input and generated arrays. The graph was generated using MATLAB [2].
1
Analysis
Table 1 presents the detailed results obtained from the element-wise operations performed on input array
A = [6 7 8 9 10], and generated array B = [1 2 3 4 5].
Discussion
The exercise involved implementing ex3p1 in MATLAB for element-wise operations on arrays. By creating
a function to perform addition, subtraction, multiplication, and division, along with visual representations
using graphs and tables, we gained practical insights into MATLAB’s array manipulation capabilities.
References
[1] R. M. Austin Bray. A Guide to MATLAB for ME 160. Iowa State University Digital Press, 2019.
[2] O. T. H. Patrick Marchand. Matlab - Graphics and GUIs with Matlab, 3rd Edition. Boca Raton, 2003.