(b) Convolution of two signals using trapz'
I need MATLAB code with diagrams and pen and paper with all diagrams by using convolution.
The convolution of the signals shown in Figure 1-1 is computed and plotted. For this procedure, a command called conv is provided in MATLAB to calculate the convolution numerically. The syntax for 'conv' is as follows:
g = conv(x, h)
where x and h are vectors for x(t) and h(t), respectively. This command generates the output vector g, having a length L = L + L - 1, where L, L, and L are the lengths of g, x, and h, respectively.
The following MATLAB program (in Figure 1-2) shows how to construct x and h vectors, convolve x and h, and plot the resulting vector g for the above example.
x(t)
h(t)
1
Figure 1-1: Two square functions to be used for convolution
Figure 1-2: The MATLAB code to convolve x(t) and h(t) in Figure 1-2