Вы находитесь на странице: 1из 4

Bulacan State University College of Engineering Ece 441L: Signal, Spectra and Signal Processing Lab Name: _________________________________

Date: ___________________ ECE 4___ Comp No. ___

Exercise No. 2: MATLAB Discrete-Time Signal 2 Objectives: In this Exercise you will learn to: 1. Create MATLAB functions of signals 2. Create MATLAB functions of signal manipulations 3. Apply the created MATLAB functions to perform DiscreteTime Signal Processing. Signal Addition 1. Copy the commands in Figure 5. You may omit the comment to shorten the typing process. 2. Save the function to your created folder in the document file and name the function as sigadd. 3. Close the Editor Window. 4. From the command window, the current directory must be the folder name you created. 5. The following signals will be used for signal addition.
x1 (n) ={2,2,2,0,1,2,3,4} x2 ( n) ={1,0,1,2,3,4,4,4,4,4}

&

6. Copy the following command to represent the signal x1(n) in MATLAB: n1=[-3:4]; x1=[2 2 2 0 1 2 3 4]; [n1;x1] % to view table of x1 wrt time n1

7. Now, create command for signal x2(n). Note: Use n2 for the time variable of x2(n).

8. To perform the signal addition:


y1 (n) = x1 ( n) + x2 (n)

Type the following command: [y1, ny1]=sigadd(x1,n1,x2,n2); 9. Write the answer in the space provided.

Signal Multiplication 10. Click New button, then copy the commands in Figure 6. Save it as sigmult. 11. Using the value of x1(n) and x2(n), the following command can be used to multiply the two signals: [y2, ny2]=sigmult(x1,n1,x2,n2); 12. Write the answer in the space provided.

Amplitude Scaling
13. If were going to implement the equation: 3 x1 ( n)

[n1;3*x1] 14. Write below the answer for this command.

15. Write the command for this equation. Clue: use amplitude scaling for negative amplitude.

y 4 ( n) = x1 ( n) x2 (n)

16. Write below the answer for this command.

17. Lets practice signal addition, multiplication and amplitude scaling. Below are the functional representations of the two inputs.

2 for 2 n 1 x3 (n) = 1 for 2 n 4 0 otherwise

1 for 3 n 0 x4 (n) = 2 for 3 n 5 0 otherwise

18. Write below the commands for representing the two inputs and their time n. Note: Use n3 for the time variable of input x3 and n4 for the time variable of input x4.

19. Write the command for this equation.


y5 (n) = 2 x3 (n) 3 x4 (n)

20. Write below the answer for this command.

21. Write the command for this equation.

y6 (n) = x3 ( n) * x4 ( n) + 2 x2 (n)

22. Write below the answer for this command.

23. Write the command for this equation.


y6 (n) = x1 (n) + x2 (n) 2 x3 (n) + x4 (n)

24. Write below the answer for this command.

Вам также может понравиться