Question: In C Program Problem 6: Convolution and Zero Padding (20%) Given two arrays, you should do the following steps: 1. Zero padding: you should add



In C Program Problem 6: Convolution and Zero Padding (20%) Given two arrays, you should do the following steps: 1. Zero padding: you should add two Os to the first array. One in the beginning and the other at the end. 2. Define convolution as len(b)-1 c[n] = a[i + n] + b[i] i=0 Where a is the first array after zero padding, b is the second array, c is the output where n is in range [0, len(a)-len(b)+1]. You can get more information from the example. Input: The first line is the length of the first array. The second line is the first array. The third line is the length of the second array. The fourth line is the second array. Output: the output array c Output 25 28 21 13 73 65 96 59 93 139 289 160 129 117 123 116 For example: Input 4 9754 3 121 10 9754391 10 11 32 5 12147 6 12 4 7 8 11 2 5 16 5 3 2 Procedure: (1) 25 = 1*0+ 2*9 + 1*7 28 = 1*9 + 2*7 + 1*5 21 = 1*7 + 2*5 + 1*4 13 = 1*5 + 2*4 + 1*0 (2) 73 = 1*0 + 2*9 + 1*7+4*5 + 7*4 65 = 1*9 +2*7 + 1*5 +4*4 + 7*3 96 = 1*7 + 2*5 + 1*4 +4*3 + 7*9 59 = 1*5 + 2*4 + 1*3 +4*9 + 7*1 93 = 1*4 + 2*3 + 1*9 +4*1 + 7*10 139 = 1*3 + 2*9 + 1*1 +4*10+ 7*11 289 = 1*9 + 2*1 + 1*10+ 4*11+ 7*32 160 = 1*1 + 2*10 + 1*11 +4*32 + 7*0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
