MATLAB Questions and Answers – Convolution – 1

This set of MATLAB Multiple Choice Questions & Answers (MCQs) focuses on “Convolution – 1”.

1. The unit step response of an L.T.I. system is the convolution of a step signal and it’s ________
a) Impulse response
b) Ramp response
c) Parabolic response
d) Time response
View Answer

Answer: a
Explanation: The response of an L.T.I. system is given by the convolution of an input and the impulse response of the system. Hence, for the unit step response of an L.T.I. system- the input is a unit step function while the convolution will be done with the impulse response. Hence, Impulse response is correct.

2. What is the output of the following code?

conv([1 2],[3 4])

a) [3 10 8]
b) [8 10 3]
c) [3 8]
d) [4 6]
View Answer

Answer: a
Explanation: The convolution of two discrete signals can be thought of as simple multiplication of the polynomials which can represent those discrete signals. However, the polynomials are represented by their coefficients with the order increasing from left to right. Hence, the above code represents the convolution of (x+2) and (3x+4) and by multiplying them we get [3 10 8] as the correct answer. Note that the answer would be represented by the aforementioned order.
advertisement
advertisement

3. What is the working of the conv2() command?
a) 2-d convolution
b) 1-d convolution
c) 3-d convolution
d) n-d convolution
View Answer

Answer: a
Explanation: The conv2() command is defined in MATLAB to perform 2d convolution. Hence, only 2-d convolution is correct. This type of convolution is essential in image processing and video processing.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

4. What is the output of the following code?

conv([1;3],[1;3])

a) A column vector of 1 6 9
b) A row vector of 9 6 1
c) A row vector of 1 6 9
d) A column vector of 9 6 1
View Answer

Answer: a
Explanation:

The vectors are 
1 1  Take anyone and place it horizontally land flip it. 
3 3							
1 3} 1  and then {3 1} 1 
3	               3
Next, shift the left matrix one step in the right and the overlapping elements are to be multiplied and added. The first operation will result in 1. 
Next, invert the left matrix vertically as {3 1 
					   1} 3
and multiply and add the overlapping elements.
Finally, invert the matrix horizontally as 1		
					   3 {3  1}. 
Multiply the overlapping element and finally we get 1 6 9 as a column vector.
advertisement

5. What is the output of the following code?

advertisement
conv(3,9)

a) 27
b) 3
c) 9
d) Error
View Answer

Answer: a
Explanation: Since the conv() command is really multiplying two signals, the above code result is 27 only. The inputs represent two polynomials which have no variable i.e. they are only constants.

6. What is the output of the following code?

conv[1 2]

a) Error in input
b) Error in []
c) 2
d) 0
View Answer

Answer: b
Explanation: The first error MATLAB notices is that the input to the conv command is given within [] but not () and this is the error it’ll return. The next error is the fact that there is no ‘ , ‘ between 1 and 2 so the conv command doesn’t understand the input.

7. What is the output of the following code?

>>p=conv([ones(1,100)],[ones(1,100)]);
>>x=[1:1:199];
>> plot(x,p)

a) A triangular pulse
b) A step pulse
c) A sinusoid
d) Error
View Answer

Answer: a
Explanation: The convolution of two rectangular pulses will result in a triangular pulse. The input to the conv(0 command are two rectangular pulses. Hence, triangular pulse is correct.

8. What is the length of the output?

p=conv([ones(1,150)],[ones(1,150)]);

a) 299
b) 298
c) 300
d) Error
View Answer

Answer: a
Explanation: The length of the output due to convolution of two discrete signals is sum of length of each signal-1. Since the length of the input vectors is 150 each, the resultant signal would have a length of 150+150-1=299 and the correct option is 299 only.

9. What is the dimension of the output?

conv([1;2],[1;2])

a) 1*3
b) 1*4
c) 1*2
d) 2*2
View Answer

Answer: a
Explanation: The dimension of the output is sum of the dimensions of length of each input-1. The dimension of each is 1*1 so the output will have 1 row but the length of columns is 2+2-1 which is equal to 3. Hence, option 1*3 is correct only.

10. What is the output of the following code?

conv([1],[2;3])

a) A column vector of 2 and 3
b) A column vector of 3 and 2
c) A row vector of 3 and 2
d) A row vector of 2 and 3
View Answer

Answer: a
Explanation: The column vector of 2 and 3 is getting convolved with 1 which is a mere constant and not a vector. Hence, the output will be the same as the vector itself.

11. What is the output of the following code?

conv({1 2},{3 4})

a) Error
b) 6 8
c) 3 8
d) 3 10 8
View Answer

Answer: a
Explanation: The conv() command doesn’t take cellular arrays as input and this leads to an error. The output would’ve been option 3 10 8 if the vectors, given as input, were within [].

12. What is the shape output of the following code?

p=conv([ones(1,100)],[ones(1,50)])

a) A trapezoid
b) A rectangular pulse
c) A triangular pulse
d) Error
View Answer

Answer: a
Explanation: An intuitive method to observe the shape of the output can be derived from the graphical convolution method. We observe that there are two pulses of unequal length. As the second vector starts overlapping on the first vector, the output increases. After it overlaps entirely on the first vector, the output would stay constant until the vector starts coming out and the output decreases linearly. Hence, the correct answer is a trapezoid.

13. What is the peak value of the output graph from the following code?

>>q=conv([1 2],[2 1]);
>> plot([0 1 2],q)

a) 5
b) 4
c) 1
d) Error
View Answer

Answer: a
Explanation: The peak value of the graph will be the peak value of the output resulting due to convolution of the two signals which is 5. Hence, the correct option is 5.

14. The output of p=conv([ones(1,50)],[ones(1,100)]) and p=conv([ones(1,100)],[ones(1,50)]) are same.
a) True
b) False
View Answer

Answer: a
Explanation: The associative property of convolution suggests that convolving a and b is same as convolving b and a. Hence, the above statement is true.

15. The signal get shifted by 1 units in time due to the following code: conv([ 1 2 3],[ 0 1 0 ]).
a) True
b) False
View Answer

Answer: a
Explanation: The 2nd row vector, in the input, acts like an impulse function delayed by 1 unit in time and exists only at t=1 unit in time. Thus, the above statement is true.

Sanfoundry Global Education & Learning Series – MATLAB.

To practice all areas of MATLAB, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.