cse108_lab5
cse108_lab5
Part 0. Write a program that performs following tasks respectively. These tasks will be performed with 1D and
2D arrays. The program must have a menu. There must be 4 operations and 1 output option on this menu.
Part1. Convolutional filter allows you to perform some manipulations on arrays. In this part, a new array will
be obtained by applying a filter on the 1-dimensional array. You will have an array with 10 elements and you
will have a filter with 3 elements. By sliding this filter one by one from the beginning of the array to the end,
you must perform calculations for all overlapping values and create the new array. Calculations should be
made as follows; A value is obtained by adding the new values found after multiplying the values on the array
with the overlapping values on the filter. In other words, the 1st element of the array and the 1st element of
the filter should be multiplied, then the sum of these 3 elements should be taken as the new value. Call this 3-
element array of the filter as Kernel. A similar example is given below. [1,0,1] is a kernel. Slide this kernel on
the array and complete the calculation. When creating arrays you have to write additional functions to get
input from the user and to create the array. You also have to print the external display() function to print the
matrices to the screen.
(1*1)+(0*0)+(0*1) = new value
Select your boundaries carefully. You have to slide the kernel from the 2nd element to (n-1). element. You
have to write the new values after the convolutional filter to a new array and print the results to the screen.
Filter Example
April 8, 2022
Example Result
Part2. In this part you will perform Matrix Operations => Multiplication, Trace, Transpose operations on 2D
arrays. When creating arrays you have to write additional functions to get input from the user and to create
the array. You also have to print the external display() function to print the matrices to the screen. All matrices
printed on the screen have to be printed with the display() function. You need to get the all matrix values from
the user then you have to create 3x3 matrices.
Example Outputs