1. Objective The objective of this LabVIEW Mini Project was to understand the following concepts: The convolution of two functions Creating LABVIEW Virtual Instruments see the visual representation of convolution sum Resulting function of multiple convolution would yield a Gaussian function 2. Brief Description on Convolution Any Discrete Time (DT) function can be expressed as a sum of scaled and time shifted delta functions. Mathematically, signal x[n] can be expressed as k x[n] = k x[k] [n-k] (1) whereas [n-k] = time shifted impulse response x[k] = the amplitude scaling factor that represents the specific amplitude of the signal x[n] at time k, when actually the impulse occurs If a signal x[n], already expressed as sum of scaled and time shifted impulses, is the input of a Linear Time Invariant (LTI) system, the output y [n] will be k y[n] = k x[k] h[n-k] (2) whereas h[n-k] = the impulse response of the shifted delta function. The impulse response of an LTI system is the output of the system when the system is excited by delta function. [n] LTI System h[n] Figure 1. Impulse Response of a DT LTI system For a LTI system, the impulse h[n], as Equation (2) shows, can be used to compute the response to any arbitrary input signal, given that the signal is expressed as a sum of scaled and time shifted impulses. This sum in Equation (2) is defined as the convolution sum and is denoted by the symbol *.
k y[n] = x[n]*h[n] = k x[k] h[n-k] (3) For a Continuous Time (CT) time signal, the convolution integral is defined by the following equation: y(t) = x(t)*h(t) = x( ) h( -t) (4) 3.1. Task A: Creating a LABVIEW Virtual Instrument (VI) to Convolve two Rectangle Functions The VI was built form Pulse Patterns, Convolution functions, some numerical elements, and graph indicators, all put inside of a while loop. Figure (2) below shows the block diagram of the IV. Figure 2. The Block Diagram of the VI to convolve two rectangle functions. The sampling rate was 1000 Hz. The width and delay of each of the Pulse Patterns were defined according to the following formulae: Width = Samples / 10 (5) Delay = (Samples / 2) (Width/2) (6) The output of each Pulse Pattern was connected to a graph indicator through a Bundle in between. Aside from the output from Pulse Pattern, two other inputs to a Bundle were a constant 1 and halved sampling rate.
The outputs of the Pulse Patterns were also fed to the Convolution function. The output of the Convolution function was divided by the width before being connected to the graph indicator through another Bundle. The remaining two input elements of this Bundle were a constant 1 and the sampling rate. When the VI was run, it displayed following results in the front panel graph indicators: Figure 3. Input Signal Figure 4. Impulse Response Figure 5. The Convolved Sum
3.2. Task B (a): Convolving a Rectangle Function with a Triangle Function Using the given VI named DT Convolution.vi, a rectangle function was convolved with a triangle function. The output is shown in the following screenshot. Figure 6. Convolution between a rectangle and a triangle functions 3.2. Task B (b)-(c): Convolving a Rectangle Function with another rectangle Function Using the DT Convolution.vi, a rectangle function was convolved with another rectangle function. The convolution sum some for different values of n were recorded in the Table 1. Table 1: Task #2 n x[n-k]h[k] -2 0 0-1 0 0 0 1 1
1 1+1 2 2 1+1+1 3 3 1+1+1+1 4 4 1+1+1 3 5 1+1 2 Below is a screenshot of the convolution functions between two rectangle functions for n =10. Figure 7. Convolution between two rectangle functions 3.3. Task C (a)
In this task, some modifications to the VI made in Task A were made to check whether the results obtained (manually) before. In the block diagram, the convolution function along with the divider was put inside a for loop. Right clicking on the box that was connected to the first Pulse Pattern, indexing was disabled. Right clicking on the box that was connected to the second Pulse Pattern, Replace with shift register was selected, and then the changed cursor was moved to the box connected to the divide output. A control was created to determine the number of loops. The function connected to the first node of the Bundle connector was modified accordingly: First Node of Bundle = (No. of Convolutions) * (-Samples / 2) + (-Samples / 2) (7) Figure 8 shows the modified block diagram. Figure 8. Modified Block Diagram Figure 9, 10, and 11 shows the convolution of two rectangle functions for convolution number 1, 2 and 3 respectively.
Figure 9. Convolution between two rectangle functions; number of convolution 1 Figure 10. Convolution between two rectangle functions; number of convolution 2 Figure 11. Convolution between two rectangle functions; number of convolution 3 3.3. Task C (b)
In this part of the task it has to be proved that the function obtained after performing 20 successive convolutions is of the following form f ( x) 2 Bx Ae (8) Taking natural logarithm on both sides, the equation could be expressed as 2 ln( f ( x)) ln A Bx (9) The block diagram used in Task B had to be modified slightly for this purpose. The output of the for loop was connected to a Natural Logarithm function, which was then connected to a graph indicator through a Bundle. The modified block diagram is shown in Figure 13. Figure 13. Modified Block Diagram for Task 3 The modified VI was run for the number of convolution set to 20, and a screenshot of the resulting graphs were taken, which are shown in Figure 13 and Figure 14.
Figure 13. Graph of x(t)*h(t) for 20 multiple convolutions
Figure 14. The graph of x versus ln [f(x)]; number of convolution 20 From this graph, the values of ln [f(x)] corresponding to x = 9 and x = -9.5 was chosen. Then using the chosen value and Equation 9, the value of constants were found to be -0.83 and e -76.13. Having found the values of constants, the following graph was plotted in MATLAB. It has x 2 in X axis and ln [f(x)] in Y axis. The resulting graph was linear one.
700 600 500 ln[f(x)] 400 300 200 100 0-100 0 100 200 300 400 500 600 700 800 900 1000 x 2 Figure 15. The graph x 2 vs ln [f(x)] Since the graph is linear, it proves that f(x), the resulting function of multiple convolutions, is of Gaussian type.