Latex-Report On Exercise 3-1: Using Element-Wise Operations: Alisher Samadov - 001818110 March 2, 2024

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

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].

Figure 1: Results of Element-wise Operations

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].

Operation Variable Formula Result


Addition F irst A+B [7 9 11 13 15]
Subtraction Second A−B [5 5 5 5 5]
Multiplication T hird A×B [6 14 24 36 50]
A
Division F ourth B [6 3.5 2.67 2.25 2]

Table 1: Element-wise Operation Results for Arrays A and B

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.

You might also like