Scilab Code for Signals and Systems by Alan V. Oppenheim, Alan V. Willsky, S.

Hamid Nawab1
Created by Prof. R. Senthilkumar Institute of Road and Transport Technology rsenthil signalprocess@in.com Cross-Checked by Prof. Saravanan Vijayakumaran, IIT Bombay sarva@ee.iitb.ac.in 18 November 2010

by a grant from the National Mission on Education through ICT, http://spoken-tutorial.org/NMEICT-Intro.This text book companion and Scilab codes written in it can be downloaded from the website http://scilab.in

1 Funded

Book Details
Author: Alan V. Oppenheim, Alan V. Willsky, S.Hamid Nawab Title: Signals and Systems Publisher: Prentice-Hall India Edition: Second Year: 1992 Place: New Delhi ISBN: 978-81-203-1246-3

1

Contents
List of Scilab Code 1 Signals and Systems 1.1 Scilab Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Linear Time Invariant Systems 2.1 Scilab Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Fourier Series Repreentation of Periodic Signals 3.1 Scilab Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 The Continuous Time Fourier Transform 4.1 Scilab Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 11 11 26 26 54 54 90 90

5 The Discreet Time Fourier Transform 117 5.1 Scilab Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 6 Time and Frequency Characterization of Signals and Systems 138 6.1 Scilab Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 7 Sampling 148 7.1 Scilab Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 9 The Laplace Transform 155 9.1 Scilab Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 10 The Z-Transform 171 10.1 Scilab Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 2

. . . . . . . .11 Linear Feedback Systems 181 11. . . . . . . . . . .1 Scilab Codes . 181 3 . . . . . . . . .

. . . . .4.sce . . 11 12 13 14 14 15 16 17 18 18 20 21 22 23 24 26 29 33 37 41 45 49 54 60 61 63 66 68 . Example2. . . . .1 1. .4 1. . . . . . . . . Example1. . . . . . . . . . . . .sce . Example1. . . . .7.7. . . . . Example3. . . . . . . . . . . . . . . . . . . . .6. . .2. . . . . . . . . . . Example2. . . . . . . . .sce . . .7 2. .sce . . . . . . . . . . . . . .sce . . . . . .2 1. . . .13 1. . . . . . . Example3. . .3 2. . . . . . .1. . . . Example1. . . . . . . . . . . . . . . . . .6. Example1.5 2. . . . . . . . . .6 3. Example1. . . . . . . .8 3.sce . . .sce . .13b 1. . . . . . . . . . . . . . . . . .sce . . . . . . . . . . . .4 3. . . . . . . . . . . . . . . . . . . . . . . .sce . . . . . . Example2. . . . . . . . Example3. . . . . .sce Example1. . Example1. . .sce . . Example1. . . . . . . . . . Example2. .13. . . .sce . .5. . . . . . . . . . . . . Example2. . . . . . . .2. .6. . . . .5 3.sce . . Example1. .6 2.8. . . . . . . . . . . . . . . .sce . . .6 1. . . . . . .sce . . . . . . . . . . . . . . . . . . . . . . . . . .16 1. . . . . Example1. . .12 1. . . .List of Scilab Code 1. . . . . . . . . . . Example3. . .5. . . . . . . . . . . . . . . . . . . . . . Example3.sce . . . . . . . . . . . . . . . . . . . . . . . .18 1. .4. . . . . . . . . . . . .4 2. . . . .sce . . . . . . . . . . . . . . 4 . . . . . Example1. .15. . .1. . . . . .3. . . . . . . . .sce . . . . .14.sce . . . . . . . . . . Example2. . . . . . . . .sce . . . . .sce . .5. . . . . . . Example2. . . . . . . . . .3.sce . . . . . . . . . .3 1. . . . . . .sce . . . . . .sce .sce . . . . . . . .3. . . . . . . . . . .17 1. . . . . . . . . . . .12. . . Example1. . . . . . . . . . . . Example3. .14 1. . . . . Example1. . . .sce . . .2 3. . . . .17. . . . . . . .20 2. . . .sce . . . .sce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3 3. . . Example1. . .15 1. . .4. . . . .20. . . . . . . . . . . . . . . . . . . .13b. .1 2. . . . . . . . . . . . . . .16. .18. .5 1. . . . . . .7 Example1.

. . . . . . . .sce . . . . . . . .sce . . . . . Example5. . . . . . . . . .12. . . . . . . . Example4.1 6. . .2 5. .sce . . . . . . . . . Example5. . .3 6. . . . . . . . . . . . . . . Example4. . . .sce . . . . .sce . . . . . . . . . . .sce . . . . .8. . . . . . . .4 6. . . . . . . . . . . . Example4. . . . . . . . . . . . . . . . . . . . .sce . . . . . .1 7. . . . .2 4. . . . . .sce . . . . . . . . . .sce .5 5. . . . . . . . . . . .13. Example3. . . .4. . . . . . . . . . . . . . . . . . .sce . . . . . . . . . . . .3. . .sce . . . .15 6. . . . Example7.15. . .18 4. . . . . . . . .5. . . . . . . . . . . . . . . . . . .2. . . . . . . . . . . . . .sce . .sce . . . . . . . .12. . . . . . . .6. . . . 71 74 76 80 82 85 87 90 93 95 97 99 101 104 106 108 110 112 114 117 121 123 125 127 129 131 133 135 138 143 145 146 148 149 150 151 151 155 . . . . . . . . . . . . . .9 4. . .14.6. .sce . . . . . . .3 5. . . . . . . . . .sce .sce . . . . .2. . .8.12. . . . . . . . . . . .18.1. . . . . . . .1. . . . . . Example7. . . . . . . Example6. . . . . . . . . . . . . .9. . . . . . . Example6. . . .sce . . . .6 4.sce . Example3. . . . . . . . . . . . . .23. . . . . . . . . Example6. . . . . . . . . . . . . . .sce . . . . .sce . . Example4. . . . . . . . . . .5 4. . . Example3. . . . .2 7. . . . . . .22 5. . . . . . .sce . . . . . . . . Example5. . . . . . . .sce . . .5. . . . . . . . Example3. . . . .14 3. . . . Example4. . .7. . . .12 4.7 4. . . . . .8 4. . . . . . . . . . . Example7. . . .15. . . . . Example5. . . . Example5. . . . . . . . . . .sce .1 5. . . . . . . .sce . . . . Example3. . . . .sce . . . . Impulse response of LTI system Example5. Example5. . . . 5 . . . Example4. . . . . .2. . . . . . . . . . . Example9.sce . . . . Example4. . . . . .sce . . . . .7. . . . . . . . . . . . . .1. . . . . . . . . . . . . . . . .3. . . . . . . . . . . . . . . . . Example7. . . .sce . . . . . . Example4. . . . . . . . . . . . . . . . . . Example3.13 3. . . . . . . . . . . . Example5. . . . .4. . . . . . . . . Example4. . . Example6. . . .11 3. . Example5. . . . . . . . . . . . . . .3. Example7. . . . . . . . . . . . . . . .sce . . . . .23 4. . . . . .1 4. . .1 Example3. . .11. . . . . . . . .3. . . . . . . . . . . .10. . .5. .1. . . . . . .15 4. . . . . . . . . .5 7. . .6 5. . . .4 4. . . . . . . . . . . . . . Example4. . . . .sce .sce . . . . . . . .sce . . . . . . . . . . . . . .sce . . . . . . . . . .7 5. . . . . . .sce . . . .4. . . . .5.1. . . . . .9 5. . . . .4 7. . . . . . . . . . . . . . . . . . .sce . . . . . . . . .3 7. . . . . . . . . . . . . . . . . . . . .sce . . .sce .8 3. Example4.9. . . . . . . . . . . . . . . . .5 9.12 5. .10 3. . . . . . . . . .12 3. . . . . . . . .

. . . . .31.7 10. . . . . . . . . . . . . . . . . . . . . . . .sce . . . . .sce . . . . . . . . . .8 9. . .9. .18. . . . . . . . . . . . . .37. .14 9. .35 9. . . .7 9. . . . Example9. . . . . . . . Example10. . . . . . . . .19. . . . .9. .3 10. . . .sce . Example9. . . . . . . . . . .sce . Example9.5 9. . Example10.12. . . . . .38. .sce . . . .17. . . .6. . . .5. . . Example9. . . . . . .3. . . . .sce . . . . . . . . . . . . . . . . . . . . . Example10. . . . Example9. .16 9. . . . . . . . .14. . . . . . . . . . . . . . . . . .12 9. . . . . . . . . . . . . .5. . .33. . . . . . Example9. 6 . . . . . .2. . . . Example9. . . . . . . . . .9 10.sce . . . . . . . . . . .sce . . . . . . . .sce . . . . . . . . . . . . . . . . . . . . . . .25 9. . . . .11 Example9.7. . . .31 9. . . . . . . Example10. . . . . . . . . . . .sce . . . . . . . . . . . . . . . .sce . . . . Example9. . . .15. . . . .36. . . . . . . . . .sce . . Example9. . . . .33 9. . . . . . . . . . . .6 10. . . . . . . . . . Example10. . . . . . . . . . . . . . . .2 10. . . . . Example9. Example9.sce .2. . . . . . . . . . . . . . . . . . . . . . . .sce .10. . . . . Example9. . . . . .11 9. . Example10. . . Example10.sce . . . . . . . . . Example9. . . . . .sce . . .4 10. . . . . . . . . . . . .5 10. . . . . . . . . . . . . .sce . . . . .10 10. . . . . . .3. . . . . . . .sce . . . . .2 9. . . . . . . Example9. . . . . . . Example9.sce . . . . . .sce . . . . . . .15 9. . . .4 9. . . . .20 9. .25. .8. . . . . .9 9. .sce . . . . .4. .37 9. . . . . . . . . . . . Example9. . . . . . . . . . . . . . . . . . . . .sce . Example9. . . . . . . . . Example10. . .sce . . Example10. . .sce . . . . . . . . . . . . .7. . . . . . . . . . . . . . . . . . . . . . . . . . Example9. .11. . . . Example9. . . . . . . . . . . . .36 9. . . . . . .21 9. . . . . . . . . . . .1 10. . . .4. . . . . .sce Example10. . . . . . . . . . . .sce . .18 9. . Example9. . . . . . . . . . . . .21.sce .6 9. . . . . . . . Example9.1. . Example9. . . .sce .sce . . . .6. . . . . . . . . . . . . . . . . . . . . .35. . . . . . . . . . 155 155 156 156 156 157 157 158 159 159 159 160 163 164 164 165 165 165 166 166 166 167 168 168 168 169 169 169 171 171 172 172 172 173 173 173 174 175 . . . . . . . . . . . . . . . . . . Example9. . . . . .34. . . . . . Example9.sce .sce . . . .sce . . . . . . . . . . .sce . . . Example9. . . . . . . . . . . . . . . . . .16. .sce . . . . . . .sce . . . . . . . . . . .sce .17 9. . . . .13. . . . . .9. . . . . . . . . . . Example9. . . . . . . . . . . . . . . . . . . . . .34 9. .3 9.10 9. . . . . . . . . . . .sce . . . . . . . . . .sce . . . . . . . . . . . . . .20.38 10.11. . . . . . . . . .10. . . . . . . . . . . . . . . . . . . . . . .13 9. . . . Example9. . .19 9. . . .

. . . . . . .5Bode.sce . . . . . . . . .1 Example11. . . . .7. . . . . . . . . . . . . . . . . . .2. . 11.18 Example10. . . . . . . .3. . . . . . . . . . . . . . . . 10. . . . . 10. . . . 10.33 Example10. . . . . . . . . . . . . . .34 Example10. . . . . . . . . .3 Example11. . . . . . . . . . . . . . 11. . . . . . . .23 Example10.sce . . . . . . . .sce . 10. . .sce . . . . . . . . .sce . . . . . . . . . . . .sce . . . . . . . 11. . . . . . . .25. . . . . . .sce . . 10. . . . . . . . . . . .25 Example10. . . . . . . .13 Example10. . . . . . . . . feedback systems . . 10. .36 Example10. . 11. . . . . . . . . . . 11. . . . . . . .12. . . . . . . . . . . . . .6. . . . . .sce . . . . . . . . . . . . . .5Nyquist Example11. . . . . .5Nyquist. . . . . . . . .36. . . .6 Example11. 11.8. . . . .23. . . . . . . . . . . . .sce . . . . . . . . . . . . . . . . . . . . . . . .1. . . . . . .34. 11. . . .37. . . . . .sce . . . 11. 11.sce . . . .9 Example11. .9. . . .2 Example11. .sce . . . . . . . . . .sce . . . . . . . . .10. . . . .5Bode Example11. . . . . .37 Example10. .13. . . 10. . . . . . . .9 Root locus analysis of Linear . . . . . 10. . . . .18. . . . . .sce . . . .33. . 175 175 176 176 177 177 178 178 179 180 181 182 183 184 185 187 188 188 189 192 7 . . . . . . .7 Example11.12 Example10. .sce . . . . . . . . . . . . . . . . . . .19 Example10. 10. . . . . . . . . . . . .8 Example11. . . . . . . . .sce . . . .sce . .19. . . . 11. . . . .sce .sce . .

List of Figures
1.1 1.2 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.17 2.18 2.19 2.20 2.21 3.1 3.2 3.3 3.4 Results of Exa 1.5 . . . . . . . . . . . . . . . . . . . . . . . . Results of Exa 1.14 . . . . . . . . . . . . . . . . . . . . . . . Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results of of of of of of of of of of of of of of of of of of of of of of of of of Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa 2.1 . 2.1 . 2.1 . 2.3 . 2.3 . 2.3 . 2.4 . 2.4 . 2.4 . 2.5 . 2.5 . 2.5 . 2.6 . 2.6 . 2.6 . 2.7 . 2.7 . 2.7 . 2.8 . 2.8 . 2.8 . 3.2 . 3.2 . 3.2 . 3.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 20 27 28 29 31 32 33 35 36 37 39 40 41 43 44 45 47 48 49 51 52 53 57 58 59 60

3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 4.10 4.11 4.12 4.13 4.14 4.15 5.1 5.2 5.3 5.4 5.5 5.6 5.7

Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results Results

of of of of of of of of of of of of of of of of of of of of of of of of of of of of of of of of of of of of

Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa

3.4 . 3.5 . 3.5 . 3.6 . 3.7 . 3.7 . 3.8 . 3.10 3.11 3.11 3.12 3.13 3.14 3.15 4.1 . 4.1 . 4.2 . 4.4 . 4.5 . 4.6 . 4.7 . 4.7 . 4.8 . 4.9 . 4.12 4.18 4.23 4.22 4.22 5.1 . 5.1 . 5.2 . 5.3 . 5.5 . 5.6 . 5.7 .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

63 65 66 68 70 71 74 76 79 80 82 85 87 89 92 93 95 97 99 101 103 104 106 108 110 112 113 115 116 120 121 123 125 127 129 131

5.8 Results of Exa 5.9 . . . . . . . . . . . . . . . . . . . . . . . . 5.9 Results of Exa 5.12 . . . . . . . . . . . . . . . . . . . . . . . 5.10 Results of Exa 5.15 . . . . . . . . . . . . . . . . . . . . . . . 6.1 6.2 6.3 6.4 6.5 6.6 7.1 7.2 9.1 9.2 9.3 9.4 Results Results Results Results Results Results of of of of of of Exa Exa Exa Exa Exa Exa 6.1 . 6.1 . 6.1 . 6.3 . 6.4 . 6.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

133 135 137 141 142 143 145 146 147 149 154 158 161 162 163 182 183 184 185 186 187 189 191 192 193

Results of Exa 7.1 . . . . . . . . . . . . . . . . . . . . . . . . Results of Exa 7.5 . . . . . . . . . . . . . . . . . . . . . . . . Results Results Results Results of of of of of of of of of of of of of of Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa 9.8 . 9.13 9.13 9.13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11.1 Results 11.2 Results 11.3 Results 11.4 Results 11.5 Results 11.6 Results 11.7 Results 11.8 Results 11.9 Results 11.10Results

11.1 . . . . 11.2 . . . . 11.3 . . . . 11.5Bode . 11.5Nyquist 11.6 . . . . 11.8 . . . . 11.9 . . . . 11.9 . . . . 11.9 . . . .

10

OPPENHEIM. end for i = length ( t ) +1:2* length ( t ) x ( i ) = 1 .Chapter 1 Signals and Systems 1.t (i .1 Time Shifting 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 // Example 1 . // t 3 = 0 : 1 / 1 0 0 : 4 / 3 . t2 = -1:1/100:1. for i = 1: length ( t ) x(i) = 1 . 2 0 0 8 E d i t i o n // Page 10 clear all . S . // t 4 = 0 : 1 / l e n g t h ( t 3 ) : 1 . WILLSKY . end t1 = 0:1/100:2. 1 : Time S h i f t i n g //SIGNALS & SYSTEMS . S . // Mid = c e i l ( l e n g t h ( t 3 ) / 2 ) . 11 .1 Scilab Codes Example 1. S e c o n d E d i t i o n //V . HAMID NAMWAB // PHI .length ( t ) ) . close . t = 0:1/100:1. clc .

t3 = 0:1/100:4/3. y_location = ” m i d d l e ” . clc . close . S . 2 0 0 8 E d i t i o n // Page 11 clear all . plot2d ( t1 . xtitle ( ’ The s i g n a l x ( t +1) ’ ) figure a = gca () . plot2d ( t2 . thickness =2. OPPENHEIM. x (1: $ -1) ) a . a . S e c o n d E d i t i o n //V . xtitle ( ’ The s i g n a l x ( t ) ’ ) figure a = gca () . HAMID NAMWAB // PHI . x (1: $ -1) ) a . thickness =2. S . y_location = ” m i d d l e ” . WILLSKY . 2 : Time S c a l i n g //SIGNALS & SYSTEMS . // end figure a = gca () .2 Time Scaling 1 2 3 4 5 6 7 8 9 10 11 12 // Example 1 . x ( $ : -1:2) ) a . for i = 1: Mid 12 . // end // f o r i = Mid +1: l e n g t h ( t 3 ) // x3 ( i ) = 1− t 4 ( i −Mid ) . a . Mid = ceil ( length ( t3 ) /2) . thickness =2. xtitle ( ’ The s i g n a l x(− t +1) ’ ) Example 1. t4 = 0:1/ length ( t3 ) :1. plot2d ( t2 .21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 // f o r i = 1 : Mid // x3 ( i ) = 1 .

figure a = gca () . OPPENHEIM. xtitle ( ’ Time S c a l i n g x ( 3 t / 2 ) ’ ) Example 1. end for i = Mid +1: length ( t3 ) x3 ( i ) = 1 .t4 (i . end t5 = -2/3:1/100:2/3. end figure a = gca () .Mid ) . t4 = 0:1/ length ( t3 ) :1. x3 ) a . a . clc . x3 ) a . xtitle ( ’ Time S c a l i n g and Time S h i f t i n g x ( ( 3 t / 2 ) +1) ’ ) 13 . Mid = ceil ( length ( t3 ) /2) . y_location = ” m i d d l e ” . S . t3 = 0:1/100:4/3.t4 (i . thickness =2. S . thickness =2. S e c o n d E d i t i o n //V .Mid ) . plot2d ( t5 . for i = 1: Mid x3 ( i ) = 1 . HAMID NAMWAB // PHI .3 Time Scaling and Time Shifting 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 // Example 1 . WILLSKY . close . 2 0 0 8 E d i t i o n // Page 11 clear all . 3 : Time S c a l i n g and Time S h i f t i n g //SIGNALS & SYSTEMS . plot2d ( t3 .13 14 15 16 17 18 19 20 21 22 x3 ( i ) = 1 . end for i = Mid +1: length ( t3 ) x3 ( i ) = 1 .

a = gca () . 14 . // F r e q u e n c y = 1 Hz t1 = 0: -1/100: -2* %pi . x1 ) . x_location = ” m i d d l e ” . xtitle ( ’ The s i g n a l x ( t ) = c o s t f o r t < 0 and s i n t for t > 0: Aperiodic Signal ’) Example 1.5 sum of two complex exponentials as a single sinusoid 1 2 3 4 5 6 7 8 9 10 11 12 13 // Example 1 . x1 = exp ( sqrt ( -1) *2* t ) . a . close . plot ( t1 .4 Combinationation two periodic signals Aperiodic signal 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 // Example 1 . y_location = ” m i d d l e ” . clc . t2 = 0:1/100:2* %pi . end plot (t . x2 = exp ( sqrt ( -1) *3* t ) . x1 = cos ( F * t1 ) . clc . 5 : To e x p r e s s sum o f two c o m p l e x exponentials // a s a s i n g l e s i n u s o i d clear all . x2 = sin ( F * t2 ) . x2 ) . close . for i = 1: length ( x ) X ( i ) = sqrt (( real ( x ( i ) ) . a .Example 1. x = x1 + x2 . F =1. X ) . plot ( t2 .^2) +( imag ( x ( i ) ) . 4 : C o m b i n a t i o n a t i o n two p e r i o d i c s i g n a l s // A p e r i o d i c s i g n a l // Page 12 clear all .^2) ) . t =0:1/100:2* %pi .

Figure 1. ’ Magnitude ’ ) . 6 : D e t e r m i n e t h e f u n d a m e n t a l p e r i o d o f composite 2 // d i s c r e t e t i m e s i g n a l 3 // x [ n ] = exp ( j ( 2 ∗ %pi / 3 ) n )+exp ( j ( 3 ∗ %pi / 4 ) n ) 4 clear all .1: Results of Exa 1.14 xtitle ( ’ F u l l wave r e c t i f i e d s i n u s o i d ’ . ’ t i m e t ’ . 1 15 .5 Example 1.6 Determining the fundamental period of composite discrete time signal // Example 1 .

integer_value = m2 break . // P e i r o d o f s i g n a l 1 N2 = (2* %pi ) / Omega2 . Omega1 = 2* %pi /3. close . integer_value = m1 break .1) ==0) period1 = period . // A n g u l a r f r e q u e n c y s i g n a l 1 Omega2 = 3* %pi /4. // A n g u l a r f r e q u e n c y s i g n a l 2 N1 = (2* %pi ) / Omega1 . 1 2 : C l a s s i f i c a t i o n o f s y s t e m : C a u s a l i t y property // Page 47 //To c h e c k w h e t h e r t h e g i v e n d i s c r e t e s y s t e m i s a C a u s a l System ( o r ) Non−C a u s a l System // Given d i s c r e t e s y s t e m y [ n ]= x[−n ] clear . end end disp ( period1 ) disp ( period2 ) //To d e t e r m i n e t h e f u n d a m e n t a l p e r i o d N N = period1 * period2 Example 1.1) ==0) period2 = period . // P e r i o d o f s i g n a l 2 //To f i n d r a t i o n a l p e r i o d o f s i g n a l 1 for m1 = 1:100 period = N1 * m1 .5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 clc . if ( modulo ( period . 16 .12 Classification of system:Causality property 1 2 3 4 5 // Example 1 . if ( modulo ( period . end end //To f i n d r a t i o n a l p e r i o d o f s i g n a l 2 for m2 = 1:100 period = N2 * m2 .

1].2 . for n = -1: -1: . end end if ( count == length ( x ) ) disp ( ’ The g i v e n s y s t e m i s a c a u s a l s y s t e m ’ ) else disp ( ’ S i n c e i t d e p e n d s on f u t u r e i n p u t v a l u e ’ ) disp ( ’ The g i v e n s y s t e m i s a non−c a u s a l s y s t e m ’ ) end Example 1. 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 // A s s i g n some v a l u e t o input n = .2 .4 .0 . end if ( S > Maximum_Limit ) 17 . clc . x = [1 .0 .8].8 .3 .length ( x ) /2: length ( x ) /2.3 . count = 0. for t = 0: Maximum_Limit -1 S = S + t * x ( t +1) .4 . x ( t ) clear .6 .5 . y ( mid +1: $ ) = x ( $ : -1: mid +1) . end for i = 1: length ( x ) if ( y ( i ) == x ( i ) ) count = count +1.6 clc . 7 x = [2 .10 .0 .1 . length ( x ) ) .n ) . mid = ceil ( length ( x ) /2) . S = 0.mid y ( n +1+ mid ) = x ( .0 . // A s s i g n some i n p u t Maximum_Limit = 10. y = zeros (1 . 1 3 : D e t e r m i n a t i o n o f s t a b l i l i t y o f a given system // Page 49 // g i v e n s y s t e m y ( t ) = t .13 Determination of stablility of a given system 1 2 3 4 5 6 7 8 9 10 11 12 // Example 1 .

disp ( ’ The v a l u e o f S = ’ ) .13 14 15 16 17 18 19 20 21 disp ( ’ Eventhough i n p u t i s bounded o u t p u t i s unbounded ’ ) disp ( ’ The g i v e n s y s t e m i s u n s t a b l e ’ ) . Maximum_Limit = 10. S = 0. disp ( S ) . 1 3 ( b ) : D e t e r m i n a t i o n o f s t a b i l i t y o f a given system // Page 50 // g i v e n s y s t e m y ( t ) = exp ( x ( t ) ) clear . end Example 1. disp ( ’ S = ’ ) . disp ( ’ S = ’ ) .14 Classification of a system:Time Invariance Property 18 . // I n p u t some bounded v a l u e S = S + exp ( x ( t +1) ) . for t = 0: Maximum_Limit -1 x ( t +1) = -2^ t .13b Determination of stability of a given system 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 // Example 1 . S end Example 1. S else disp ( ’ The g i v e n s y s t e m i s s t a b l e ’ ) . S else disp ( ’ The g i v e n s y s t e m i s s t a b l e ’ ) . clc . end if ( S > Maximum_Limit ) disp ( ’ Eventhough i n p u t i s bounded o u t p u t i s unbounded ’ ) disp ( ’ The g i v e n s y s t e m i s u n s t a b l e ’ ) .

1 4 : c l a s s i f i c a t i o n o f a s y s t e m : Time Invariance Property // Page 51 //To c h e c k w h e t h e r t h e g i v e n s y s t e m i s a Time v a r i a n t ( o r ) Time In−v a r i a n t // The g i v e n d i s c r e t e s i g n a l i s y ( t ) = s i n ( x ( t ) ) clear . to = 2.to ) . clc . y ( t ) = sin ( x ( t ) ) . Output_shift = y (T . if ( Input_shift == Output_shift ) disp ( ’ The g i v e n d i s c r e t e s y s t e m i s a Time In− v a r i a n t system ’ ). else disp ( ’ The g i v e n d i s c r e t e s y s t e m i s a Time V a r i a n t system ’ ).to ) ) . end // F i r s t s h i f t t h e i n p u t s i g n a l o n l y Input_shift = sin ( x (T . // Assume t h e amount o f t i m e s h i f t =2 T = 10.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 // Example 1 . end 19 . // Length o f g i v e n signal for t = 1: T x ( t ) = (2* %pi / T ) * t .

no = 2. // Length o f g i v e n signal 20 . // Assume t h e amount o f t i m e s h i f t =2 L = 10. 1 5 : C l a s s i f i c a t i o n o f a System : Time Invariance Property // Page 51 //To c h e c k w h e t h e r t h e g i v e n s y s t e m i s a Time v a r i a n t ( o r ) Time In−v a r i a n t // The g i v e n d i s c r e t e s i g n a l i s y [ n ] = n . x [ n ] clear .15 Classification of a System:Time Invariance Property 1 2 3 4 5 6 7 8 // Example 1 .14 Example 1.Figure 1.2: Results of Exa 1. clc .

9 for n = 1: L 10 x(n) = n.9 .7 . 20 end Example 1. y = zeros (1 . 18 19 else disp ( ’ The g i v e n d i s c r e t e s y s t e m i s a Time V a r i a n t system ’ ). to = 2.10]. 16 if ( Input_shift == Output_shift ) 17 disp ( ’ The g i v e n d i s c r e t e s y s t e m i s a Time In− v a r i a n t system ’ ).2 . // Assume t h e amount o f t i m e s h i f t =2 T = 10.5 . Output_shift = y (T . 12 end 13 // F i r s t s h i f t t h e i n p u t s i g n a l o n l y 14 Input_shift = x (L .6 . clc .to ) . 1 6 : C l a s s i f i c a t i o n o f s y s t e m : Time Invariance Property // Page 52 //To c h e c k w h e t h e r t h e g i v e n s y s t e m i s a Time v a r i a n t ( o r ) Time In−v a r i a n t // The g i v e n d i s c r e t e s i g n a l i s y ( t ) = x ( 2 t ) clear .8 . 15 Output_shift = y (L . for t = 1: length ( x ) /2 y ( t ) = x (2* t ) . 11 y(n) = n*x(n).to ) . 21 . end // F i r s t s h i f t t h e i n p u t s i g n a l o n l y Input_shift = x (T .no ) .16 Classification of system:Time Invariance Property 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 // Example 1 .4 .no ) . length ( x ) ) . if ( Input_shift == Output_shift ) disp ( ’ The g i v e n d i s c r e t e s y s t e m i s a Time In− v a r i a n t system ’ ). // Length o f g i v e n signal x = [1 .3 .

b = 1. for t = 1: length ( x1 ) x3 ( t ) = a * x1 ( t ) + b * x2 ( t ) .2]. a = 1. y2 ( t ) = t * x2 ( t ) .2 .2 .19 20 else disp ( ’ The g i v e n d i s c r e t e s y s t e m i s a Time V a r i a n t system ’ ). y3 ( t ) = t * x3 ( t ) . end end if ( count == length ( y3 ) ) 22 .1 . x2 = [2 . end for t = 1: length ( y1 ) z ( t ) = a * y1 ( t ) + b * y2 ( t ) .1 . end for t = 1: length ( x1 ) y1 ( t ) = t * x1 ( t ) . end count = 0. for n =1: length ( y1 ) if ( y3 ( t ) == z ( t ) ) count = count +1. x1 = [1 .1]. 21 end Example 1. clc . 1 7 : C l a s s i f i c a t i o n o f s y s t e m : L i n e a r i t y Property // Page 54 //To c h e c k w h e t h e r t h e g i v e n d i s c r e t e s y s t e m i s a L i n e a r System ( o r ) Non−L i n e a r System // Given d i s c r e t e s y s t e m y ( t )= t ∗ x ( t ) clear .17 Classification of system:Linearity Property 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 // Example 1 .

1].18 Classsification of a system:Linearity Property 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 // Example 1 . end for t = 1: length ( y1 ) z ( t ) = a * y1 ( t ) + b * y2 ( t ) .2]. a = 1. x2 = [2 .29 30 31 32 33 34 35 36 disp ( ’ S i n c e I t s a t i s i f i e s t h e s u p e r p o s i t i o n principle ’) disp ( ’ The g i v e n s y s t e m i s a L i n e a r s y s t e m ’ ) y3 z else disp ( ’ S i n c e I t d o e s n o t s a t i s i f y t h e superposition principle ’) disp ( ’ The g i v e n s y s t e m i s a Non−L i n e a r s y s t e m ’ ) end Example 1.2 . b = 1.1 . y3 ( t ) = ( x3 ( t ) ^2) . end count = 0.1 . for t = 1: length ( x1 ) x3 ( t ) = a * x1 ( t ) + b * x2 ( t ) . for n =1: length ( y1 ) 23 . 1 8 : C l a s s s i f i c a t i o n o f a s y s t e m : L i n e a r i t y Property // Page 54 //To c h e c k w h e t h e r t h e g i v e n d i s c r e t e s y s t e m i s a L i n e a r System ( o r ) Non−L i n e a r System // Given d i s c r e t e s y s t e m y ( t )= ( x ( t ) ˆ 2 ) clear . clc . x1 = [1 . y2 ( t ) = ( x2 ( t ) ^2) .2 . end for t = 1: length ( x1 ) y1 ( t ) = ( x1 ( t ) ^2) .

1]. y3 ( n ) = 2* x3 ( n ) +3.2 . b = 1. for n = 1: length ( x1 ) x3 ( n ) = a * x1 ( n ) + b * x2 ( n ) .2]. end 24 . y2 ( n ) = 2* x2 ( n ) +3. a = 1.2 .24 if ( y3 ( t ) == z ( t ) ) 25 count = count +1.1 . 2 0 : C l a s s s i f i c a t i o n o f a s y s t e m : L i n e a r i t y Property // Page 55 //To c h e c k w h e t h e r t h e g i v e n d i s c r e t e s y s t e m i s a L i n e a r System ( o r ) Non−L i n e a r System // Given d i s c r e t e s y s t e m y [ n ] ) = 2∗ x [ n ]+3 clear . x2 = [2 .1 . 26 end 27 end 28 if ( count == length ( y3 ) ) 29 disp ( ’ S i n c e I t s a t i s i f i e s 30 31 32 33 34 the s u p e r p o s i t i o n principle ’) disp ( ’ The g i v e n s y s t e m i s a L i n e a r s y s t e m ’ ) y3 z else disp ( ’ S i n c e I t d o e s n o t s a t i s i f y t h e superposition principle ’) 35 disp ( ’ The g i v e n s y s t e m i s a Non−L i n e a r s y s t e m ’ ) 36 end Example 1.20 Classsification of a system:Linearity Property 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 // Example 1 . clc . x1 = [1 . end for n = 1: length ( x1 ) y1 ( n ) = 2* x1 ( n ) +3.

for n =1: length ( y1 ) if ( y3 ( n ) == z ( n ) ) count = count +1. end end if ( count == length ( y3 ) ) disp ( ’ S i n c e I t s a t i s i f i e s t h e s u p e r p o s i t i o n principle ’) disp ( ’ The g i v e n s y s t e m i s a L i n e a r s y s t e m ’ ) y3 z else disp ( ’ S i n c e I t d o e s n o t s a t i s i f y t h e superposition principle ’) disp ( ’ The g i v e n s y s t e m i s a Non−L i n e a r s y s t e m ’ ) end 25 .19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 for n = 1: length ( y1 ) z ( n ) = a * y1 ( n ) + b * y2 ( n ) . end count = 0.

1 .0 .1 . ’ n ’ .1 Linear Convolution Sum 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 // Example 2 . N2 = -2:4. h = [0 . for i = 1: length ( y ) if ( y ( i ) <=0. h ) . plot2d3 ( ’ gnn ’ . end end N = -4:8. ’ h [ n ] ’ ) .N1 .1 Scilab Codes Example 2. clc .0 . h ) xtitle ( ’ I m p u l s e R e s p o n s e ’ . y = convol (x . 26 .5 .0 . N1 = -2:4. 1 : L i n e a r C o n v o l u t i o n Sum // p a g e 80 clear all .0 .0 . figure a = gca () .0. x = [0 .0001) y ( i ) =0.0].Chapter 2 Linear Time Invariant Systems 2.1 . close .0].2 .

N .21 22 23 24 25 26 27 28 29 30 31 a . a . x ) xtitle ( ’ I n p u t R e s p o n s e ’ . ’ n ’ . ’ n ’ . thickness = 2. thickness = 2. ’ y [ n ] ’ ) .1 27 . figure a = gca () . Figure 2. figure a = gca () . y ) xtitle ( ’ Output R e s p o n s e ’ . plot2d3 ( ’ gnn ’ . thickness = 2.N2 . plot2d3 ( ’ gnn ’ .1: Results of Exa 2. a . ’ x [ n ] ’ ) .

2: Results of Exa 2.1 28 .Figure 2.

1 Example 2. clc . 29 .3: Results of Exa 2. h = ones (1 .3 Convolution Sum:Convolution of x[n] and Unit Impulse response h[n] 1 2 3 4 5 6 7 8 // Example 2 . Max_Limit ) . close . Max_Limit = 10. 3 : C o n v o l u t i o n Sum : C o n v o l u t i o n o f x [ n ] and // U n i t I m p u l s e r e s p o n s e h [ n ] clear .Figure 2. N1 = 0: Max_Limit -1.

y (1: Max_Limit ) . plot2d3 ( ’ gnn ’ . h ) . // a l p h a < 1 for n = 1: Max_Limit x ( n ) = ( Alpha ^( n -1) ) *1. 5 . N = 0:2* Max_Limit -2. 5 . a . x ) xtitle ( ’ I n p u t R e s p o n s e F i g 2 . plot2d3 ( ’ gnn ’ . thickness = 2. ’ n ’ . ( a ) ’ . ’ n ’ . y = convol (x . ’ h [ n ] ’ ) . a . ’ n ’ . ’ x [ n ] ’ ) . 7 ’ .5. figure a = gca () . figure a = gca () . a .9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Alpha = 0. h ) xtitle ( ’ I m p u l s e R e s p o n s e F i g 2 .N (1: Max_Limit ) . ( b ) ’ . figure a = gca () . end N2 = 0: Max_Limit -1. 30 . thickness = 2. ’ y [ n ] ’ ) . plot2d3 ( ’ gnn ’ . thickness = 2.5) xtitle ( ’ Output R e s p o n s e F i g 2 .N2 .N1 .

3 31 .Figure 2.4: Results of Exa 2.

Figure 2.3 32 .5: Results of Exa 2.

6: Results of Exa 2.4. // a l p h a > 1 for n = 1:7 h ( n ) = ( Alpha ^( n -1) ) *1.4 Convolution Sum of finite duration sequences 1 2 3 4 5 6 7 8 9 // Example 2 .3 Example 2. 4 : C o n v o l u t i o n Sum o f f i n i t e d u r a t i o n sequences clear .5) . clc . close .Figure 2. 33 . N1 =0: length ( x ) -1. x = ones (1 . Alpha = 1.

a .N . 34 . a . plot2d3 ( ’ gnn ’ . figure a = gca () .10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 end N2 =0: length ( h ) -1. y ) xtitle ( ’ Output R e s p o n s e ’ . N = 0: length ( x ) + length ( h ) -2. ’ n ’ .N1 . thickness = 2. ’ h [ n ] ’ ) . thickness = 2. ’ x [ n ] ’ ) . ’ n ’ . plot2d3 ( ’ gnn ’ . thickness = 2. x ) xtitle ( ’ I n p u t R e s p o n s e ’ . plot2d3 ( ’ gnn ’ . h ) xtitle ( ’ I m p u l s e R e s p o n s e ’ . h ) . a . figure a = gca () . figure a = gca () .N2 . ’ n ’ . ’ y [ n ] ’ ) . y = convol (x .

7: Results of Exa 2.Figure 2.4 35 .

8: Results of Exa 2.4 36 .Figure 2.

37 .u[−n]andh[n] = u[n] 1 2 3 4 5 6 7 8 // Example 2 .Figure 2. Max_Limit = 10. u[−n ] // and h [ n ] = u [ n ] clear . Max_Limit ) . N2 =0: length ( h ) -1.4 Example 2. clc .5 Convolution Sum of input sequence x[n] = (2n ). close . h = ones (1 . 5 : C o n v o l u t i o n Sum o f i n p u t s e q u e n c e x [ n ] = ( 2 ˆ n ) .9: Results of Exa 2.

’ n ’ .N1 . a . y = convol (x . plot2d3 ( ’ gnn ’ . 38 . ’ y [ n ] ’ ) . plot2d3 ( ’ gnn ’ . end x = x1 ( $ : -1:1) . thickness = 2. a .length ( x ) +1:0.9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 for n = 1: Max_Limit x1 ( n ) = (2^( -( n -1) ) ) *1. ’ n ’ . figure a = gca () . a . thickness = 2. h ) xtitle ( ’ I m p u l s e R e s p o n s e ’ . thickness = 2. y ) xtitle ( ’ Output R e s p o n s e F i g 2 . 1 1 ( a ) ’ .length ( x ) +1: length ( h ) -1. a . figure a = gca () . figure a = gca () . y_location = ” o r i g i n ” . plot2d3 ( ’ gnn ’ . ’ h [ n ] ’ ) . ’ x [ n ] ’ ) . N1 = .N2 . 1 1 ( b ) ’ . y_location = ” o r i g i n ” . ’ n ’ . x ) xtitle ( ’ I n p u t R e s p o n s e F i g 2 .N . a . h ) . N = .

5 39 .10: Results of Exa 2.Figure 2.

5 40 .Figure 2.11: Results of Exa 2.

Figure 2.12: Results of Exa 2. close . 6 : C o n v o l u t i o n I n t e g r a l o f i n p u t x ( t ) = ( eˆ− a t ) .5.5 Example 2. N2 =0: length ( h ) -1. a = 0. h = ones (1 . Max_Limit = 10.u(t)andh(t) = u(t) 1 2 3 4 5 6 7 8 9 // Example 2 .6 onvolution Integral of input x(t) = (e− at). // c o n s t a n t a>0 41 . u ( t ) // and h ( t ) =u ( t ) clear . clc . Max_Limit ) .

’ t ’ . ’ y ( t ) ’ ) . ’ h ( t ) ’ ) . ’ t ’ . y = convol (x . plot2d ( N2 . figure a = gca () . 42 . figure a = gca () . a . figure a = gca () .10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 for t = 1: Max_Limit x ( t ) = exp ( .a *( t -1) ) . thickness = 2. thickness = 2. thickness = 2. end N1 =0: length ( x ) -1.y (1: Max_Limit ) ) xtitle ( ’ Output R e s p o n s e ’ . N = 0: length ( x ) + length ( h ) -2. h ) xtitle ( ’ I m p u l s e R e s p o n s e ’ . ’ x ( t ) ’ ) . ’ t ’ . a . h ) -1. plot2d ( N1 . x ) xtitle ( ’ I n p u t R e s p o n s e ’ . a . plot2d ( N (1: Max_Limit ) .

6 43 .13: Results of Exa 2.Figure 2.

Figure 2.14: Results of Exa 2.6 44 .

15: Results of Exa 2. close . // I n p u t R e s p o n s e for t = 1:2* T h ( t ) = t -1. T ) .7 Convolution Integral of fintie duration signals 1 2 3 4 5 6 7 8 9 // Example 2 . x = ones (1 .Figure 2.6 Example 2. clc . 7 : C o n v o l u t i o n I n t e g r a l o f f i n t i e duration s ign als // p a g e 9 9 clear . // I m p u l s e R e s p o n s e 45 . T = 10.

x_location = ” o r i g i n ” . a . thickness = 2. figure a = gca () . h ) . ’ y ( t ) ’ ) . ’ t ’ . figure a = gca () . N = 0: length ( x ) + length ( h ) -2. ’ t ’ . thickness = 2. y = convol (x . a . a . h ) xtitle ( ’ I m p u l s e R e s p o n s e ’ . N2 = 0: length ( h ) -1.10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 end N1 = 0: length ( x ) -1. plot2d ( N2 . ’ x ( t ) ’ ) . plot2d (N . ’ h ( t ) ’ ) . x ) xtitle ( ’ I n p u t R e s p o n s e ’ . ’ t ’ . y ) xtitle ( ’ Output R e s p o n s e ’ . a . thickness = 2. figure a = gca () . plot2d ( N1 . 46 .

16: Results of Exa 2.Figure 2.7 47 .

17: Results of Exa 2.Figure 2.7 48 .

8 : C o n v o l u t i o n I n t e g r a l o f i n p u t x ( t ) =( e ˆ2 t ) . Max_Limit = 10. 49 . // h ( n −3) a = 2. Max_Limit -3) ]. clc .Figure 2.0 .0 . h =[0 .u(−t)andh(t) = u(t − 3) 1 2 3 4 5 6 7 8 // Example 2 .18: Results of Exa 2. ones (1 . u(− t ) and // h ( t ) = u ( t −3) clear .8 Convolution Integral of input x(t) = (e2 t).7 Example 2. close .

y_location = ” o r i g i n ” . thickness = 2. y2 = (1/ a ) * ones (1 . plot2d (t .13 . 50 . y_location = ” o r i g i n ” . a . // x = x1 ( $ : − 1 : 1 ) N2 = 0: length ( h ) -1. t1 = -6:3.1]. plot2d ( . y = [ y1 y2 ] N = . x_location = ” o r i g i n ” . thickness = 2. figure a = gca () . x_location = ” o r i g i n ” . ’ t ’ . N1 = . a .9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 t = -9:0. a .Max_Limit +4: Max_Limit +3 . a . data_bounds =[ -10 . ’ t ’ . ’ t ’ .length ( x ) +1:0. thickness = 2. y1 = (1/ a ) * exp ( a *( t1 -3) ) . Max_Limit ) . figure a = gca () . h ( $ : -1:1) ) xtitle ( ’ I m p u l s e R e s p o n s e ’ . ’ h ( t−T) ’ ) . plot2d ( . a . figure a = gca () . y_location = ” o r i g i n ” . a .0. a . ’ x ( t ) ’ ) . y ) xtitle ( ’ Output R e s p o n s e ’ . x ) xtitle ( ’ I n p u t R e s p o n s e ’ . ’ y ( t ) ’ ) .length ( h ) +1: length ( x ) -1. x = exp ( a * t ) .Max_Limit +1:0 . a . a .

Figure 2.8 51 .19: Results of Exa 2.

20: Results of Exa 2.8 52 .Figure 2.

21: Results of Exa 2.Figure 2.8 53 .

// t 1 = −%pi ∗ 4 : ( %pi ∗ 4 ) / 1 0 0 : %pi ∗ 4 . x2t = cos ( %pi *4* t ) . // t 2 =−%pi ∗ 6 : ( %pi ∗ 6 ) / 1 0 0 : %pi ∗ 6 . xt = xot + x1t + x2t + x3t . xot_x1t = xot + x1t . t = -3:0.2 CTFS of a periodic signal x(t)Expression of continuous time signal 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 // Example 3 .Chapter 3 Fourier Series Repreentation of Periodic Signals 3. xot_x1t_x2t = xot + x1t + x2t .1 Scilab Codes Example 3.01:3. length ( t ) ) . x1t = (1/2) * cos ( %pi *2* t ) . close . x3t = (2/3) * cos ( %pi *6* t ) . // 54 . xot = ones (1 . 2 : CTFS o f a p e r i o d i c s i g n a l x ( t ) // E x p r e s s i o n o f c o n t i n u o u s t i m e s i g n a l // u s i n g c o n t i n u o u s t i m e f o u r i e r s e r i e s clear . clc .

55 .2) a = gca () . x_location = ” o r i g i n ” . y_location = ” o r i g i n ” . a . a . a . y_location = ” o r i g i n ” .1) a = gca () .0. data_bounds =[ -4 .2 4]. xot_x1t ) ylabel ( ’ t ’ ) title ( ’ xo ( t )+x1 ( t ) ’ ) // figure subplot (2 . x_location = ” o r i g i n ” .1 . a . y_location = ” o r i g i n ” . -3. plot (t . -2. data_bounds =[ -4 . xot ) ylabel ( ’ t ’ ) title ( ’ x o t =1 ’ ) // figure subplot (2 . x_location = ” o r i g i n ” .18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 figure a = gca () . a . y_location = ” o r i g i n ” .2 4].2) a = gca () . a . a . a . x1t ) ylabel ( ’ t ’ ) title ( ’ x1 ( t ) =1/2∗ c o s ( 2 ∗ p i ∗ t ) ’ ) subplot (2 . plot (t . data_bounds =[ -4 .1) a = gca () . plot (t . a .1 .4 2].1 . a . a . plot (t .1 . x2t ) ylabel ( ’ t ’ ) title ( ’ x2 ( t ) =c o s ( 4 ∗ p i ∗ t ) ’ ) subplot (2 .0. a .2 4]. x_location = ” o r i g i n ” . data_bounds =[ -4 .

y_location = ” o r i g i n ” . y_location = ” o r i g i n ” . x_location = ” o r i g i n ” . -3. data_bounds =[ -4 . a . data_bounds =[ -4 . a . x_location = ” o r i g i n ” .4 4]. plot (t .0. plot (t .2) a = gca () . xot_x1t_x2t ) ylabel ( ’ t ’ ) title ( ’ xo ( t )+x1 ( t )+x2 ( t ) ’ ) // figure subplot (2 . plot (t . -3. a .1 .4 3].1 . y_location = ” o r i g i n ” . a .56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 a .1) a = gca () . a . a .4 3]. x3t ) ylabel ( ’ t ’ ) title ( ’ x1 ( t ) =2/3∗ c o s ( 6 ∗ p i ∗ t ) ’ ) subplot (2 . a . a . xt ) ylabel ( ’ t ’ ) title ( ’ x ( t )=xo ( t )+x1 ( t )+x2 ( t )+x3 ( t ) ’ ) 56 . x_location = ” o r i g i n ” . data_bounds =[ -4 .

1: Results of Exa 3.Figure 3.2 57 .

2 58 .2: Results of Exa 3.Figure 3.

Figure 3.3: Results of Exa 3.2 59 .

2 Example 3. 3 : C o n t i n u o u s Time F o u r i e r S e r i e s Coefficients of // a p e r i o d i c s i g n a l x ( t ) = s i n ( Wot ) clear .4: Results of Exa 3. clc .Figure 3. T = 1.3 Continuous Time Fourier Series Coefficients of a periodic signal x(t) = sin(W ot) 1 2 3 4 5 6 7 8 // Example3 . 60 . t = 0:0. close .01:1. Wo = 2* %pi / T .

ak = [ a_conj ( $ : -1:1) . for k =0:5 C ( k +1 . a ( k +1) = xt * C ( k +1 .:) ’/ length ( t ) . t = 0:0. Wo = 2* %pi / T . 4 : CTFS c o e f f i c i e n t s o f a p e r i o d i c s i g n a l // x ( t ) = 1+ s i n ( Wot ) +2 c o s ( Wot )+c o s ( 2 Wot+%pi / 4 ) clear . a (2: $ ) ]. if ( abs ( a ( k +1) ) <=0. for i = 1: length ( a ) Phase_ak ( i ) = atan ( imag ( ak ( i ) ) /( real ( ak ( i ) ) +0.sqrt ( -1) * Wo * t .:) ’/ length ( t ) . xt = ones (1 . a_conj = conj ( a ) .* k ) .sqrt ( -1) * Wo * t . Mag_ak = abs ( ak ) .01) a ( k +1) =0.0001) ) . if ( abs ( a ( k +1) ) <=0. a ( k +1) = xt * C ( k +1 . ak = [ -a . Example 3.:) = exp ( .01:1. clc .a (2: $ ) ]. T = 1.4 CTFS coefficients of a periodic signal x(t) = 1 + sin(W ot) + 2cos(W ot) + cos(2W ot + pi/4) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 // Example3 . close . 61 . for k =0:5 C ( k +1 . length ( t ) ) + sin ( Wo * t ) +2* cos ( Wo * t ) + cos (2* Wo * t + %pi /4) .1) a ( k +1) =0. end end a =a ’. end end a =a ’.:) = exp ( .9 10 11 12 13 14 15 16 17 18 xt = sin ( Wo * t ) .* k ) .

Mag_ak . x_location = ” o r i g i n ” .5) poly1 = a . poly1 . Phase_ak .2) a = gca () . a .1 .k : k ] . x_location = ” o r i g i n ” . thickness = 3.[ .1) a = gca () . plot2d3 ( ’ gnn ’ .[ . children (1) . a . title ( ’ <(ak ) ’ ) xlabel ( ’ k ’) 36 37 38 39 40 41 42 43 44 62 . y_location = ” o r i g i n ” . y_location = ” o r i g i n ” . children (1) .1 . a . thickness = 3.k : k ] . children (1) . plot2d3 ( ’ gnn ’ . children (1) .5) poly1 = a . a .Phase_ak ($ -1: -1:1) ]. title ( ’ a b s ( ak ) ’ ) xlabel ( ’ k ’) subplot (2 .23 24 25 26 27 28 29 30 31 32 33 34 35 end Phase_ak = Phase_ak ’ Phase_ak = [ Phase_ak (1: $ ) . figure subplot (2 . poly1 .

5 CTFS coefficients of a periodic signal x(t) = 1. T1<| t |<T/2 clear . | t |<T1 . Wo = 2* %pi / T .5: Results of Exa 3. t = .T1 : T1 /100: T1 . T1 = T /4. and0. 63 .4 Example 3. clc . T =4. 5 : CTFS c o e f f i c i e n t s o f a p e r i o d i c s i g n a l // x ( t ) = 1 . close . T 1 < |t| < T /2 1 2 3 4 5 6 7 8 9 // Example3 . |t| < T 1. and 0 .Figure 3.

40 a . 43 poly1 . thickness = 3. 39 a . x_location = ” o r i g i n ” .10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 xt = ones (1 . poly1 . k = [ .sqrt ( -1) * imag ( a (:) ) . a ( k +1) = xt * C ( k +1 . a . // figure a = gca () . if ( abs ( a ( k +1) ) <=0. // for k =0:5 C ( k +1 . length ( t ) ) .:) = exp ( . a . plot2d (t . y_location = ” o r i g i n ” . xt .k ( $ : -1:1) . children (1) .k . x_location = ” o r i g i n ” .:) ’/ length ( t ) .k (2: $ ) ].5) 42 poly1 = a .sqrt ( -1) * Wo * t .* k ) .1) a ( k +1) =0. children (1) . 44 title ( ’ a b s ( ak ) ’ ) 45 xlabel ( ’ 64 . children (1) . end end a =a ’. y_location = ” o r i g i n ” .0. a_conj = real ( a (:) ) . Spectrum_ak . 41 plot2d3 ( ’ gnn ’ .2].5) poly1 = a . ak = [ a_conj ( $ : -1:1) ’. thickness = 3.a (2: $ ) ]. a . children (1) . data_bounds =[ -2 . Spectrum_ak = (1/2) * real ( ak ) . title ( ’ x ( t ) ’ ) xlabel ( ’ t ’) 36 // 37 figure 38 a = gca () . k = 0:5.2 .

6: Results of Exa 3.k ’) Figure 3.5 65 .

5 Example 3.7: Results of Exa 3. T1 = T /2. t = 0: T1 /100: T1 . // k =0 . T =4. length ( t ) ) . gt =(1/2) * ones (1 . 6 : Time S h i f t P r o p e r t y o f CTFS clear . close .6 Time Shift Property of CTFS 1 2 3 4 5 6 7 8 9 10 // Example3 . Wo = 2* %pi / T . a (1) =0.Figure 3. ak =0 66 . clc .

y_location = ” o r i g i n ” . children (1) . if ( abs ( a ( k +1) ) <=0. for k =1:5 a ( k +1) = ( sin ( %pi * k /2) /( k * %pi ) ) . thickness = 3. title ( ’ g ( t ) ’ ) xlabel ( ’ t ’) 67 . a .01) a ( k +1) =0.5) poly1 = a . a .1 . end d ( k +1) = a ( k +1) * exp ( .gt .5 ’) d // figure a = gca () . plot2d ([ . end k = 0:5 disp ( ’ F o u r i e r S e r i e s C o e f f i c i e n t s o f S q u a r e Wave ’ ) a disp ( ’ F o u r i e r S e r i e s C o e f f i c i e n t s o f g ( t )=x ( t −1) −0.[ .11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 d (1) =0.t (1: $ ) ] . children (1) .sqrt ( -1) * k * %pi /2) .4]. gt ] . -2. a .t ( $ : -1:1) . poly1 . x_location = ” o r i g i n ” . data_bounds =[ -1 .

7 : D e r i v a t i v e P r o p e r t y o f CTFS clear . gt =(1/2) * ones (1 .Figure 3.8: Results of Exa 3. e 0 = 1/2 68 . T =4. close .6 Example 3. // k =0 . xt = [ t ( $ : -1:1) t ]/ T1 . T1 = T /2. clc . e (1) = 1/2.7 Derivative Property of CTFS 1 2 3 4 5 6 7 8 9 10 // Example3 . length ( t ) ) . t = 0: T1 /100: T1 .

xt . 69 37 38 39 40 41 42 43 44 .1 .11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 for k =1:5 a ( k +1) = ( sin ( %pi * k /2) /( k * %pi ) ) .0. x_location = ” o r i g i n ” . end k = 0:5 disp ( ’ F o u r i e r S e r i e s C o e f f i c i e n t s o f S q u a r e Wave ’ ) a disp ( ’ F o u r i e r S e r i e s C o e f f i c i e n t s o f g ( t )=x ( t −1) −0. a .sqrt ( -1) * k * %pi /2) .2].5) poly1 = a . -2. thickness = 3. title ( ’ g ( t ) ’ ) xlabel ( ’ t ’) // P l o t t i n g t h e T r i a n g u l a r waveform figure a = gca () . a . x_location = ” o r i g i n ” .t ( $ : -1:1) . y_location = ” o r i g i n ” .5 ’) d disp ( ’ F o u r i e r S e r i e s C o e f f i c i e n t s o f T r i a n g u l a r Wave ’) e // P l o t t i n g t h e t i m e s h i f t e d s q u a r e waveform figure a = gca () . children (1) . y_location = ” o r i g i n ” . a . gt ] . data_bounds =[ -1 . children (1) .t ( $ : -1:1) . children (1) . children (1) . if ( abs ( a ( k +1) ) <=0.5) poly1 = a .gt .2].1 .t (1: $ ) ] . end d ( k +1) = a ( k +1) * exp ( .t (1: $ ) ] .01) a ( k +1) =0. a . e ( k +1) = 2* d ( k +1) /( sqrt ( -1) * k * %pi ) . a . plot2d ([ . data_bounds =[ -1 .[ . poly1 . plot2d ([ . a .

thickness = 3. title ( ’ x ( t ) ’ ) xlabel ( ’ t ’ ) Figure 3.45 46 47 poly1 .7 70 .9: Results of Exa 3.

10: Results of Exa 3.0 . t = [ -T . T =4.1]. close . T ].Figure 3. 8 : F o u r i e r S e r i e s R e p r e s e n t a t i o n o f P e r i o d i c Impulse Train clear . T1 = T /4. // G e n e r a t i o n o f P e r i o d i c t r a i n o f Impulses 71 .7 Example 3.8 Fourier Series Representation of Periodic Impulse Train 1 2 3 4 5 6 7 8 // Example3 . clc .1 . xt = [1 .

y_location = ” o r i g i n ” .5) poly1 = a . poly1 . thickness = 3. for k =1:5 b ( k +1) = ak *( exp ( sqrt ( -1) * k * Wo * T1 ) .0 . // D e r i v a t i v e o f p e r i o d i c s q u a r e wave Wo = 2* %pi / T . -1].T1 .exp ( . length ( t1 ) ) .6 . // G e n e r a t i o n o f 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 periodic s q u a r e wave t2 = [ . a .0 . if ( abs ( c ( k +1) ) <=0. end c ( k +1) = b ( k +1) /( sqrt ( -1) * k * Wo ) .0.1) a = gca () . children (1) .1) b ( k +1) =0. xt .T1 : T1 /100: T1 . x_location = ” o r i g i n ” . c (1) = 2* T1 / T .1 .t . qt = [1 . plot2d3 ( ’ gnn ’ . T1 ].9 t1 = . data_bounds =[ -6 .sqrt ( -1) * k * Wo * T1 ) ) . children (1) .2].1) c ( k +1) =0. title ( ’ x ( t ) ’ ) 72 . ak = 1/ T . a . 10 gt = ones (1 . b (1) = 0. end end k = 0:5 disp ( ’ F o u r i e r S e r i e s C o e f f i c i e n t s o f p e r i o d i c S q u a r e Wave ’ ) disp ( b ) disp ( ’ F o u r i e r S e r i e s C o e f f i c i e n t s o f d e r i v a t i v e o f p e r i o d i c s q u a r e wave ’ ) disp ( c ) // P l o t t i n g t h e p e r i o d i c t r a i n o f i m p u l s e s figure subplot (3 . if ( abs ( b ( k +1) ) <=0. a .

poly1 .5) poly1 = a . thickness = 3.2].0. children (1) . plot2d ( . -2. data_bounds =[ -6 .2]. plot2d ( t1 . thickness = 3. plot2d3 ( ’ gnn ’ . y_location = ” o r i g i n ” . poly1 . children (1) . a . gt . plot2d ( T + t1 .t2 . children (1) . x_location = ” o r i g i n ” . x_location = ” o r i g i n ” . children (1) .3) a = gca () .43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 // P l o t t i n g t h e p e r i o d i c s q u a r e waveform subplot (3 . a . y_location = ” o r i g i n ” . qt . gt . title ( ’ q ( t ) ’ ) 73 . children (1) .5) poly1 = a . a . children (1) .2) a = gca () . children (1) . qt . plot2d3 ( ’ gnn ’ .5) poly1 = a .6 . thickness = 3.1 . thickness = 3. children (1) . children (1) . poly1 = a . a . poly1 . children (1) . children (1) . a .6 . poly1 . a . children (1) . title ( ’ g ( t ) ’ ) // P l o t t i n g t h e p e r i o d i c s q u a r e waveform subplot (3 .T + t2 .5) poly1 = a . poly1 . plot2d3 ( ’ gnn ’ .-T + t2 .5) poly1 = a .1 .5) poly1 = a . poly1 . gt . children (1) . thickness = 3. children (1) . data_bounds =[ -6 . thickness = 3. poly1 .T + t1 . qt . thickness = 3.

n = 0:0. N = 5. close . xn = sin ( Wo * n ) .* k ) . for k =0: N -2 C ( k +1 .11: Results of Exa 3.sqrt ( -1) * Wo * n . 1 0 : DTFS o f x [ n ] =s i n (Won) clear .01:5. clc . Wo = 2* %pi / N .:) = exp ( .Figure 3. 74 .8 Example 3.10 DTFS of x(n) = sin(W on) 1 2 3 4 5 6 7 8 9 10 // Example3 .

thickness = 3. -( N + k ) . children (1) .imag ( ak ) .8 . children (1) . y_location = ” o r i g i n ” . if ( abs ( a ( k +1) ) <=0. thickness = 3. x_location = ” o r i g i n ” .5) poly1 = a . thickness = 3. children (1) . ak = [ a_conj ( $ : -1:1) ..:) ’/ length ( n ) .01) a ( k +1) =0.a (2: $ ) ] k = -(N -2) :( N -2) . a . // figure a = gca () . end end a =a ’ a_conj = conj ( a ) . . . poly1 = a . title ( ’ ak ’ ) 75 . plot2d3 ( ’ gnn ’ . a .imag ( ak ( $ : -1:1) ) .1].5) poly1 = a . thickness = 3. data_bounds =[ -8 . children (1) .N +k . children (1) . poly1 . poly1 . plot2d3 ( ’ gnn ’ .5) poly1 = a . poly1 .11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 a ( k +1) = xn * C ( k +1 . -1.k . a .imag ( ak ) . poly1 . children (1) . plot2d3 ( ’ gnn ’ . children (1) . children (1) .

12: Results of Exa 3. Wo = 2* %pi / N . N = 10. n = 0:0.11 DTFS of x(n) = 1 + sin(2 ∗ pi/N ) ∗ n + 3 ∗ cos(2 ∗ pi/N ) ∗ n + cos((4 ∗ pi/N ) ∗ n + pi/2) 1 2 3 4 5 6 7 8 // Example3 .01: N . close . 76 . 1 1 : DTFS o f // x [ n ] = 1+ s i n ( 2 ∗ %pi /N) n+3 c o s ( 2 ∗ %pi /N) n+c o s [ ( 4 ∗ %pi /N ) n+%pi / 2 ] clear .Figure 3. clc .10 Example 3.

children (1) . 42 plot2d3 ( ’ gnn ’ . // figure subplot (2 . for i = 1: length ( a ) Phase_ak ( i ) = atan ( imag ( ak ( i ) ) /( real ( ak ( i ) ) +0.5) 77 . y_location = ” o r i g i n ” .9 xn = ones (1 . imag ( ak ) . a ( k +1) = xn * C ( k +1 .1) a = gca () .a (2: $ ) ].Phase_ak ( $ : -1:1) ].:) ’/ length ( n ) . end end a =a ’. for k =0: N -2 C ( k +1 .:) = exp ( . k = -(N -2) :( N -2) . children (1) .1) a ( k +1) =0. y_location = ” o r i g i n ” . x_location = ” o r i g i n ” .* k ) .5) poly1 = a . length ( n ) ) + sin ( Wo * n ) +3* cos ( Wo * n ) + cos (2* Wo 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 * n + %pi /2) .k .k . Mag_ak = abs ( ak ) .1 .sqrt ( -1) * Wo * n . 41 a . title ( ’ R e a l p a r t o f ( ak ) ’ ) xlabel ( ’ k ’) 38 subplot (2 . plot2d3 ( ’ gnn ’ .0001) ) .1 . x_location = ” o r i g i n ” . ak = [ a_conj ( $ : -1:1) . thickness = 3. a . poly1 .2) 39 a = gca () . a . a_conj = conj ( a ) . if ( abs ( a ( k +1) ) <=0. 40 a . end Phase_ak = Phase_ak ’ Phase_ak = [ Phase_ak (1: $ -1) . real ( ak ) .

1 . a . thickness = 3.k .k . children (1) . Mag_ak . children (1) . title ( ’ <(ak ) ’ ) xlabel ( ’ k ’) 78 . thickness = 3. 56 title ( ’ a b s ( ak ) ’ ) 57 xlabel ( ’ 58 59 60 61 62 63 64 65 66 k ’) subplot (2 . children (1) . poly1 .5) 54 poly1 = a .43 44 45 46 poly1 = a . y_location = ” o r i g i n ” . Phase_ak . 51 a .5) poly1 = a . plot2d3 ( ’ gnn ’ . y_location = ” o r i g i n ” .2) a = gca () . 55 poly1 . title ( ’ i m a g i n a r y p a r t o f ( ak ) ’ ) xlabel ( ’ k ’) 47 // 48 figure 49 subplot (2 . x_location = ” o r i g i n ” . children (1) . a .1) 50 a = gca () . 52 a . thickness = 3. 53 plot2d3 ( ’ gnn ’ .1 . children (1) . x_location = ” o r i g i n ” . children (1) . poly1 .

13: Results of Exa 3.Figure 3.11 79 .

12 DTFS coefficients of periodic square wave 1 2 3 4 5 6 7 8 9 // Example3 . 1 2 : DTFS c o e f f i c i e n t s o f p e r i o d i c s q u a r e wave clear . 80 . xn = ones (1 .14: Results of Exa 3.11 Example 3. Wo = 2* %pi / N . N = 10. n = -(2* N1 +1) :(2* N1 +1) . N1 = 2. close . clc .Figure 3. length ( N ) ) .

x_location = ” o r i g i n ” . y_location = ” o r i g i n ” . plot2d3 ( ’ gnn ’ .5) poly1 = a . real ( ak ) . a_conj = conj ( a ) . a . children (1) . thickness = 3. ak = [ a_conj ( $ : -1:1) .10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 a (1) = (2* N1 +1) / N .5) ) / N ) / sin ( %pi * k / N ) . if ( abs ( a ( k +1) ) <=0. for k =1:2* N1 a ( k +1) = sin ((2* %pi * k *( N1 +0. children (1) . a .1) a ( k +1) =0.k . end end a =a ’. a ( k +1) = a ( k +1) / N .a (2: $ ) ]. title ( ’ R e a l p a r t o f ( ak ) ’ ) xlabel ( ’ k ’) 81 . // figure a = gca () . poly1 . k = -2* N1 :2* N1 .

clc .Figure 3. x1 = [ x1 ( $ : -1:1) x1 (2: $ ) ].0 . x1 = [1 .15: Results of Exa 3. n = 0: N -1.1 .13 TFS:Expression of periodic sequence using 1 2 3 4 5 6 7 8 9 10 // Example3 .0 . N = 5. // S q u a r e Wave x1 [ n ] 82 . 1 3 : DTFS // E x p r e s s i o n o f p e r i o d i c s e q u e n c e u s i n g // t h e summation two d i f f e r e n t s e q u e n c e clear . close .12 Example 3.1].

2) 46 a = gca () .1 . k = -(N -1) :( N -1) . x2 = [ x2 ( $ : -1:1) x2 (2: $ ) ]. children (1) . x_location = ” o r i g i n ” .1 . ak = [ a_conj ( $ : -1:1) . children (1) . //DC s e q u e n c e o f x2 [ n ] x = x1 + x2 . end end a =a ’. a . n = -(N -1) :( N -1) .5) poly1 = a . // sum o f x1 [ n ] & x2 [ n ] // Z e r o t h DTFS c o e f f i c i e n t o f dc s e q u e n c e c (1) = 1.1 . // Wo = 2* %pi / N .11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 x2 = [1 .1 . a_conj = conj ( a ) . thickness = 3. plot2d3 ( ’ gnn ’ . 83 . // Z e r o t h DTFS c o e f f i c i e n t o f s q u a r e waveform b (1) = 3/5. a . // Z e r o t h DTFS c o e f f i c i e n t o f sum o f x1 [ n ] & x2 [ n ] a (1) = b (1) + c (1) . if ( abs ( a ( k +1) ) <=0.1) a ( k +1) =0.1].1 . for k =1: N -1 a ( k +1) = sin ((3* %pi * k ) / N ) / sin ( %pi * k / N ) . y_location = ” o r i g i n ” . a ( k +1) = a ( k +1) / N .1) a = gca () .n . // figure subplot (3 .a (2: $ ) ]. poly1 .x . title ( ’ x [ n ] ’ ) xlabel ( ’ n ’) 45 subplot (3 .

48 a . x_location = ” o r i g i n ” . x_location = ” o r i g i n ” . y_location = ” o r i g i n ” . 58 plot2d3 ( ’ gnn ’ . children (1) . children (1) .n .5) 50 poly1 = a . 60 poly1 . children (1) .5) 59 poly1 = a . 56 a . 52 title ( ’ x1 [ n ] ’ ) 53 xlabel ( ’ n ’) 54 subplot (3 . 49 plot2d3 ( ’ gnn ’ . thickness = 3. 57 a . x2 .n . thickness = 3.47 a . 51 poly1 . x1 .1 . 61 title ( ’ x2 [ n ] ’ ) 62 xlabel ( ’ n ’) 84 .3) 55 a = gca () . y_location = ” o r i g i n ” . children (1) .

13 Example 3. N = 6. 85 . a (1) = 1/3. close . n = 0: N -1. a (4) =0. 1 4 : DTFS // F i n d i n g x [ n ] u s i n g p a r s e v a l ’ s r e l a t i o n o f DTFS clear .14 DTFS:Finding x[n] using parseval’s relation of DTFS 1 2 3 4 5 6 7 8 9 10 // Example3 . a (2) =0.Figure 3.16: Results of Exa 3. clc .

n = -(N -1) :( N -1) .n . children (1) . plot2d3 ( ’ gnn ’ . a .5) poly1 = a . a . y_location = ” o r i g i n ” . thickness = 3.x . else x = x + a ( k +1) . children (1) . title ( ’ x [ n ] ’ ) xlabel ( ’ n ’) 86 .11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 a (5) =0. poly1 . // figure a = gca () . end end x = [ x ( $ : -1:1) . x_location = ” o r i g i n ” . a1 = (1/6) *(( -1) ^ n ) . x =0.x (2: $ ) ]. for k = 0: N -2 if ( k ==2) x = x + a1 .

W = X . 1 5 : DTFS : P e r i o d i c C o n v o l u t i o n P r o p e r t y clear . close . w = ifft ( W ) .1].0 .Figure 3.0 .* X .15 DTFS:Periodic Convolution Property 1 2 3 4 5 6 7 8 9 10 // Example3 . X = fft ( x ) .17: Results of Exa 3. for i =1: length ( x ) 87 . w = abs ( w ) . x = [1 .0 .1 . clc .14 Example 3.0 .

N = length ( x ) . end end w = [ w ( $ : -1:1) w (2: $ ) ]. x_location = ” o r i g i n ” .1) w ( i ) = 0. figure a = gca () . children (1) . plot2d3 ( ’ gnn ’ . children (1) .1: N -1] .11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 if ( abs ( w ( i ) ) <=0. y_location = ” o r i g i n ” .5) poly1 = a . title ( ’w [ n ] ’ ) xlabel ( ’ n ’) 88 . a . a . w . thickness = 3. poly1 .[ -(N -1) :0 .

Figure 3.15 89 .18: Results of Exa 3.

1 Scilab Codes Example 4. xt = exp ( .1 Continuous Time Fourier Transform of a Continuous Time Signal x(t) = exp(−A ∗ t)u(t). // // C o n t i n u o u s −t i m e F o u r i e r T r a n s f o r m Wmax = 2* %pi *1. close .Chapter 4 The Continuous Time Fourier Transform 4. // Analog F r e q u e n c y = 1Hz K = 4.A * t ) . W = k * Wmax / K . // Analog S i g n a l A =1.005. // A m p l i t u d e Dt = 0. t >0 clear . XW = xt * exp ( . 90 . t = 0: Dt :10. k = 0:( K /1000) : K . clc . 1 : C o n t i n u o u s Time F o u r i e r T r a n s f o r m o f a // C o n t i n u o u s Time S i g n a l x ( t )= exp (−A∗ t ) u ( t ) .sqrt ( -1) *t ’* W ) * Dt . t > 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 // Example 4 .

’ ) . a . [ XW_Phase . xlabel ( ’ t i n s e c . XW_Phase (2:1001) ].18 XW_Mag = abs ( XW ) . W (2:1001) ]. a . ylabel ( ’ a b s (X(jW) ) ’ ) title ( ’ Magnitude R e s p o n s e (CTFT) ’ ) // P l o t t i n g Phase Reponse o f CTS subplot (2 . XW_Phase = [ . a = gca () .1 . xt ) . a = gca () . XW_Mag (2:1001) ]. XW_Mag ) . a . db ] = phasemag ( XW ) . plot (t . XW_Phase * %pi /180) .2) . a . plot (W . ylabel ( ’ <X (jW) ’ ) title ( ’ Phase R e s p o n s e (CTFT) i n R a d i a n s ’ ) 91 . y_location = ” o r i g i n ” . y_location = ” o r i g i n ” . // P l o t t i n g C o n t i n u o u s Time S i g n a l figure a = gca () .1 .mtlb_fliplr ( XW_Phase ) . xlabel ( ’ Frequency in R a d i a n s / S e c o n d s −−−> W’ ) .1) . y_location = ” o r i g i n ” . x_location = ” o r i g i n ” .mtlb_fliplr ( W ) . plot (W . // Omega from − 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 Wmax t o Wmax XW_Mag = [ mtlb_fliplr ( XW_Mag ) . ylabel ( ’ x ( t ) ’ ) title ( ’ C o n t i n u o u s Time S i g n a l ’ ) figure // P l o t t i n g Magnitude R e s p o n s e o f CTS subplot (2 . 19 W = [ . xlabel ( ’ F r e q u e n c y i n R a d i a n s / S e c o n d s −−−> W’ ) .

1: Results of Exa 4.1 92 .Figure 4.

93 . t = -4. // Analog S i g n a l A =1. 2 : C o n t i n u o u s Time F o u r i e r T r a n s f o r m o f a // C o n t i n u o u s Time S i g n a l x ( t )= exp (−A∗ a b s ( t ) ) clear .5. close .1 Example 4.2 Continuous Time Fourier Transform of a Continuous Time Signal x(t) = exp(−A ∗ abs(t)) 1 2 3 4 5 6 7 8 9 // Example 4 .2: Results of Exa 4.005.Figure 4. // A m p l i t u d e Dt = 0.5: Dt :4. clc .

’ ) .mtlb_fliplr ( W ) . XW = real ( XW ) . xt ) . W (2:1001) ]. y_location = ” o r i g i n ” . subplot (1 . xlabel ( ’ t i n s e c . // Omega from − Wmax t o Wmax XW = [ mtlb_fliplr ( XW ) . W = [ . a = gca () . a . a = gca () . W = k * Wmax / K .2) .1 . XW ) . y_location = ” o r i g i n ” . a . XW (2:1001) ]. xlabel ( ’ F r e q u e n c y i n R a d i a n s / S e c o n d s W’ ) . // // C o n t i n u o u s −t i m e F o u r i e r T r a n s f o r m Wmax = 2* %pi *1.1) subplot (2 . ylabel ( ’X(jW) ’ ) title ( ’ C o n t i n u o u s −t i m e F o u r i e r T r a n s f o r m ’ ) 94 . XW = xt * exp ( .A * abs ( t ) ) .1) . plot (W . ylabel ( ’ x ( t ) ’ ) title ( ’ C o n t i n u o u s Time S i g n a l ’ ) subplot (2 .10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 xt = exp ( . plot (t .1 .sqrt ( -1) *t ’* W ) * Dt . k = 0:( K /1000) : K . // Analog F r e q u e n c y = 1Hz K = 4.1 .

7 close . 4 2 // C o n t i n u o u s Time F o u r i e r T r a n s f o r m 3 // and F r e q u e n c y R e s p o n s e o f a S q u a r e Waveform 4 // x ( t )= A. from −T1 t o T1 5 clear . // A m p l i t u d e 95 .3: Results of Exa 4. 6 clc .Figure 4.2 Example 4. f rom − T 1toT 1 1 // Example 4 .4 Continuous Time Fourier Transform and Frequency Response of a Square Waveform x(t) = A. 8 // CTS S i g n a l 9 A =1.

plot (t . end // // C o n t i n u o u s −t i m e F o u r i e r T r a n s f o r m Wmax = 2* %pi *1. k = 0:( K /1000) : K . title ( ’ C o n t i n u o u s −t i m e F o u r i e r T r a n s f o r m X(jW) ’ ) 96 . plot (W . data_bounds =[ -4 . xlabel ( ’ F r e q u e n c y i n R a d i a n s / S e c o n d s ’ ) .sqrt ( -1) *t ’* W ) * Dt .1) .2) .4 . a = gca () . ’ ) . a . a = gca () . xt ) .10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 Dt = 0. W (2:1001) ]. y_location = ” o r i g i n ” . XW = xt * exp ( . // Time i n s e c o n d s t = . title ( ’ C o n t i u o u s Time S i g n a l x ( t ) ’ ) subplot (2 . y_location = ” o r i g i n ” .mtlb_fliplr ( W ) . W = [ . // Analog F r e q u e n c y = 1Hz K = 4. XW_Mag (2:1001) ]. T1 = 4. xlabel ( ’ t i n msec .0. // subplot (2 . for i = 1: length ( t ) xt ( i ) = A .1 . // Omega from − Wmax t o Wmax XW_Mag = [ mtlb_fliplr ( XW_Mag ) . XW_Mag = real ( XW ) .2]. XW_Mag ) . xt = xt ’. a . W = k * Wmax / K . a .1 .T1 /2: Dt : T1 /2.005.

4: Results of Exa 4. from -T1 to T1 1 // Example 4 . 5 2 // I n v e r s e C o n t i n u o u s Time F o u r i e r T r a n s f o r m 3 // X(jW)= 1 .5 Inverse Continuous Time Fourier Transform X(jW ) = 1. 7 // CTFT 8 A =1.4 Example 4. 6 close . from −T1 t o T1 4 clear . 5 clc . 97 .Figure 4. // A m p l i t u d e 9 Dw = 0.005.

// Time i n s e c o n d s w = . xlabel ( ’ t time i n Seconds ’ ). a . xt =(1/(2* %pi ) ) * XW * exp ( sqrt ( -1) *w ’* t ) * Dw . 27 title ( ’ I n v e r s e C o n t i n u o u s Time F o u r i e r T r a n s f o r m x ( t ) ’) 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 98 . end XW = XW ’. plot (t . a .%pi : %pi / length ( w ) : %pi . x_location = ” o r i g i n ” . // // I n v e r s e C o n t i n u o u s −t i m e F o u r i e r T r a n s f o r m t = .W1 = 4. for i = 1: length ( w ) XW ( i ) = A . figure a = gca () . xt ) . y_location = ” o r i g i n ” . xt = real ( xt ) .W1 /2: Dw : W1 /2.

9 T = 4* T1 .Figure 4. 6 close .5 Example 4. 7 // CTFT 8 T1 = 2. 6 2 // C o n t i n u o u s Time F o u r i e r T r a n s f o r m o f Symmetric 3 // p e r i o d i c S q u a r e waveform 4 clear .5: Results of Exa 4. 5 clc . 99 .6 Continuous Time Fourier Transform of Symmetric periodic Square waveform 1 // Example 4 .

plot2d3 ( ’ gnn ’ . children (1) . poly1 = a . poly1 .%pi : Wo : %pi .2) . children (1) . y_location = ” o r i g i n ” . XW (1) = (2* %pi * Wo * T1 / %pi ) . poly1 .W ( mid_value : $ ) . poly1 = a .W (1: mid_value -1) . for k = 2: mid_value XW ( k ) = (2* %pi * sin (( k -1) * Wo * T1 ) /( %pi *( k -1) ) ) .10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Wo = 2* %pi / T . end figure a = gca () . plot2d3 ( ’ gnn ’ . a . children (1) . delta = ones (1 . children (1) . mid_value = ceil ( length ( W ) /2) . xlabel ( ’W i n r a d i a n s / S e c o n d s ’ ) .XW . x_location = ” o r i g i n ” . thickness = 3.2) . length ( W ) ) . a . XW ( $ : -1:2) . W = . title ( ’ C o n t i n u o u s Time F o u r i e r T r a n s f o r m o f P e r i o d i c S q u a r e Wave ’ ) 100 . thickness = 3.

7 // CTFT 8 T1 = 2.Figure 4. 6 close . 101 . 9 T = 4* T1 . 7 2 // C o n t i n u o u s Time F o u r i e r T r a n s f o r m s o f 3 // S i n u s o i d a l w a v e f o r m s ( a ) s i n ( Wot ) ( b ) c o s ( Wot ) 4 clear .6: Results of Exa 4.7 Continuous Time Fourier Transforms of Sinusoidal waveforms (a)sin(Wot) (b)cos(Wot) 1 // Example 4 . 5 clc .6 Example 4.

a . thickness = 3. Wo ]. 32 poly1 = a . x_location = ” o r i g i n ” . ak1 = (2* %pi * Wo * T1 / %pi ) . // figure a = gca () .ak . XW1 =[ ak1 .W .0 . plot2d3 ( ’ gnn ’ . x_location = ” o r i g i n ” . y_location = ” o r i g i n ” .10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 Wo = 2* %pi / T .0 . 35 title ( ’CTFT o f c o s ( Wot ) ’ ) 102 .0 . 34 xlabel ( ’ W’ ) . 30 a . xlabel ( ’ W’ ) . children (1) . ak1 ].W . W = [ . 25 title ( ’CTFT o f s i n ( Wot ) ’ ) 26 // 27 figure 28 a = gca () . ak = (2* %pi * Wo * T1 / %pi ) / sqrt ( -1) .Wo . poly1 . imag ( XW ) . poly1 = a . children (1) . ak ].2) . thickness = 3. XW1 . children (1) . 31 plot2d3 ( ’ gnn ’ . y_location = ” o r i g i n ” . 33 poly1 . XW = [ . children (1) . 29 a .2) . a .

7: Results of Exa 4.7 103 .Figure 4.

T1 = 1.8: Results of Exa 4. 104 .8 Continuous Time Fourier Transform of Periodic Impulse Train 1 2 3 4 5 6 7 8 9 10 // Example 4 ..Figure 4. close .7 Example 4. 8 // C o n t i n u o u s Time F o u r i e r T r a n s f o r m s o f // P e r i o d i c I m p u l s e T r a i n clear . clc . length ( T ) ) . // S a m p l i n g I n t e r v a l xt = ones (1 . // CTFT T = -4:4.

children (1) . children (1) . a . Wo = 2* %pi / T1 . a . XW = 2* %pi * ak * ones (1 . plot2d3 ( ’ gnn ’ .1 . poly1 . W = Wo * T . plot2d3 ( ’ gnn ’ .2) . XW . 33 title ( ’CTFT o f P e r i o d i c I m p u l s e T r a i n ’ ) 105 . children (1) .11 12 13 14 15 16 17 18 19 20 21 22 23 ak = 1/ T1 .1 .T .2) . poly1 = a . y_location = ” o r i g i n ” . thickness = 3. poly1 = a . title ( ’ P e r i o d i c I m p u l s e T r a i n ’ ) subplot (2 . xlabel ( ’ t ’ ). a . children (1) . xt .W . x_location = ” o r i g i n ” . x_location = ” o r i g i n ” .2) a = gca () . figure subplot (2 .1) a = gca () . poly1 . xlabel ( ’ 24 25 26 27 28 29 30 31 32 t ’ ). a . length ( T ) ) . thickness = 3. y_location = ” o r i g i n ” .

close .8 Example 4.1:3/2. // CTFT t1 = -1/2:0. 106 .9 Continuous Time Fourier Transform Properties: Linearity and Time Shift Property 1 2 3 4 5 6 7 8 // Example 4 . 9 : C o n t i n u o u s Time F o u r i e r T r a n s f o r m Properties : // L i n e a r i t y and Time S h i f t P r o p e r t y clear . t2 = -3/2:0.Figure 4. clc .1:1/2.9: Results of Exa 4.

length ( t1 ) ) . a . x2 (( $ . x_location = ” o r i g i n ” . a .5.1 .3) a = gca () . plot ( t4 . plot ( t1 . x_location = ” o r i g i n ” . a . length ( t2 ) ) . a . t4 = t2 +2. y_location = ” o r i g i n ” .1 .ceil ( length ( x2 ) /3) ) +2: $ ) ]. plot ( t2 . x2 = ones (1 . x_location = ” o r i g i n ” . a . y_location = ” o r i g i n ” . x = [ x2 (1: floor ( length ( x2 ) /3) ) . x1 + x2 ( ceil ( length ( x2 ) /3) :$ . x2 ) xtitle ( ’ x2 ( t ) ’ ) subplot (3 . x1 = (1/2) * x1 .floor ( length ( x2 ) /3) ) .1 . subplot (3 . t3 = t1 +2.1) a = gca () . x1 ) xtitle ( ’ x1 ( t ) ’ ) subplot (3 . x ) xtitle ( ’ x ( t ) ’ ) 107 . y_location = ” o r i g i n ” .2) a = gca () . a .9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 x1 = ones (1 .5.

12 Continuous Time Fourier Transform: Derivative property 1 2 3 4 5 6 7 8 9 10 // Example 4 . zeros (1 .1:1.10: Results of Exa 4. clc . x2 = [ -1 .9 Example 4. // CTFT t = -1:0. x = t. close .Figure 4. length ( t ) -2) . length ( t ) ) . -1]. 1 2 : C o n t i n u o u s Time F o u r i e r T r a n s f o r m : // D e r i v a t i v e p r o p e r t y clear . x1 = ones (1 . 108 .

2) a = gca () . plot (t . x ) xtitle ( ’ x ( t ) ’ ) 109 .11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 // d i f f e r e n t i a t i o n o f x can be e x p r e s s e d a s // summation o f x1 and x2 subplot (3 . plot (t . a . a .3) a = gca () . x_location = ” o r i g i n ” . x_location = ” o r i g i n ” . plot2d3 ( ’ gnn ’ . y_location = ” o r i g i n ” . a .1 . y_location = ” o r i g i n ” . x1 ) xtitle ( ’ x1 ( t ) ’ ) subplot (3 .t . a .1 .1 .1) a = gca () . x2 ) xtitle ( ’ x2 ( t ) ’ ) subplot (3 . a . y_location = ” o r i g i n ” . a . x_location = ” o r i g i n ” .

12 Example 4. // Magnitude o f F i l t e r 110 .Figure 4. 1 8 : F r e q u e n c y R e s p o n s e o f I d e a l Low p a s s Filter // X(jW)= 1 . clc . from −T1 t o T1 clear .Wc :0. Wc = 10. // 1 r a d / s e c W = . close . from -T1 to T1 1 2 3 4 5 6 7 8 // Example 4 .1: Wc .11: Results of Exa 4.18 Frequency Response of Ideal Low pass Filter X(jW ) = 1. // Passband o f f i l t e r HW0 = 1.

1 . y_location = ” o r i g i n ” . plot (W . xtitle ( ’ I m p u l s e R e s p o n s e o f F i l t e r h ( t ) ’ ) 111 . x_location = ” o r i g i n ” .9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 HW = HW0 * ones (1 . Dw = 0. a . figure subplot (2 .1) a = gca () . a . y_location = ” o r i g i n ” .1.1 . ht =(1/(2* %pi ) ) * HW * exp ( sqrt ( -1) *W ’* t ) * Dw . a . // I n v e r s e C o n t i n u o u s −t i m e F o u r i e r T r a n s f o r m t = . HW ) . x_location = ” o r i g i n ” . ht ) . xtitle ( ’ F r e q u e n c y R e s p o n s e o f F i l t e r H(jW) ’ ) subplot (2 . plot (t . length ( W ) ) . a .2) a = gca () .%pi : %pi / length ( W ) : %pi . ht = real ( ht ) .

length ( W1 ) ) .1:1.1:2. clc . W1 = -1:0. length ( W2 ) ) .12: Results of Exa 4. // F o u r i e r T r a n s f o r m o f s i n c f u n c i o n i s s q u a r e wave XW1 = (1/ %pi ) * ones (1 .Figure 4. W = -3:0.23 Multiplication Property of CTFT 1 2 3 4 5 6 7 8 9 10 // F i g u r e 4 . //CTFT o f x1 ( t ) XW2 = (1/(2* %pi ) ) * ones (1 .1:3. //CTFT o f x2 ( t ) 112 . 2 3 : M u l t i p l i c a t i o n P r o p e r t y o f CTFT clear .18 Example 4. close . W2 = -2:0.

13: Results of Exa 4. XW ) . 18 xlabel ( ’ F r e q u e n c y i n R a d i a n s / S e c o n d s −−−> W’ ) .23 113 . 16 a .11 XW = (1/2) * convol ( XW1 . 19 title ( ’ M u l t i p l i c a t i o n P r o p e r t y X(jW) ’ ) Figure 4. XW2 ) . //CTFT o f x ( t )=x1 ( t ) ∗ x2 ( t ) 12 //X( jw ) = l i n e a r c o n v o l u t i o n o f X1 ( jw ) and X2 ( jw ) 13 figure 14 a = gca () . 17 plot (W . x_location = ” o r i g i n ” . 15 a . y_location = ” o r i g i n ” .

ht = exp ( . clc . // P l o t t i n g C o n t i n u o u s Time S i g n a l figure a = gca () . // A m p l i t u d e Dt = 0. HW_Mag ) . W (2:1001) ]. // C o n t i n u o u s −t i m e F o u r i e r T r a n s f o r m Wmax = 2* %pi *1. a . close .sqrt ( -1) *t ’* W ) * Dt . plot (t . HW = ht * exp ( .22 // F i g u r e 4 .2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 Example 4. W = k * Wmax / K . xlabel ( ’ F r e q u e n c y i n R a d i a n s / S e c o n d s −−−> W’ ) . HW_Mag = abs ( HW ) . W = [ . t >0 clear . ’ ) . 2 2 1 // P l o t t i n g C o n t i n u o u s Time F o u r i e r T r a n s f o r m o f // I m p u l s e R e s p o n s e h ( t )= exp (−A∗ t ) u ( t ) . plot (W . HW_Mag (2:1001) ]. k = 0:( K /1000) : K . y_location = ” o r i g i n ” . a . title ( ’ I m p u l s e R e s p o n s e h ( t ) ’ ) figure // P l o t t i n g Magnitude R e s p o n s e o f CTS a = gca () . xlabel ( ’ t i n s e c . // Omega from − Wmax t o Wmax HW_Mag = [ mtlb_fliplr ( HW_Mag ) . t = 0: Dt :10.mtlb_fliplr ( W ) .005.A * t ) . // Analog S i g n a l A =1. // Analog F r e q u e n c y = 1Hz K = 4. title ( ’ F r e q u e n c y R e s p o n s e H(jW) ’ ) 114 . y_location = ” o r i g i n ” . ht ) .

14: Results of Exa 4.22 115 .Figure 4.

15: Results of Exa 4.Figure 4.22 116 .

clc . close .5. a>0 and a<0 clear . a > 0anda < 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 // Example 5 . // DTS S i g n a l a1 = 0. end n = 0: max_limit -1. for n = 0: max_limit -1 x1 ( n +1) = ( a1 ^ n ) .5. a2 = -0.u[n]. max_limit = 10.1 Discrete Time Fourier Transform of discrete sequence x[n] = (an ). // D i s c r e t e −t i m e F o u r i e r T r a n s f o r m Wmax = 2* %pi .1 Scilab Codes Example 5.Chapter 5 The Discreet Time Fourier Transform 5. x2 ( n +1) = ( a2 ^ n ) . 117 . 1 : D i s c r e t e Time F o u r i e r T r a n s f o r m o f d i s c r e t e sequence // x [ n ]= ( a ˆn ) . u [ n ] .

XW1_Phase (2:1001) ].17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 K = 4. // p l o t f o r a>0 figure subplot (3 . k = 0:( K /1000) : K . a = gca () . title ( ’ Magnitude R e s p o n s e a b s (X(jW) ) ’ ) subplot (3 . XW2_Phase = [ . plot2d (W . XW2_Mag (2:1001) ]. x1 = x1 ’. XW2_Mag = abs ( XW2 ) . XW1_Phase = [ . XW1 = x1 * exp ( . a = gca () . XW2 = x2 * exp ( .mtlb_fliplr ( W ) . XW1_Mag = abs ( XW1 ) .sqrt ( -1) *n ’* W ) .1) .mtlb_fliplr ( XW2_Phase ) .3) . y_location = ” o r i g i n ” . db ] = phasemag ( XW2 ) . xtitle ( ’ D i s c r e t e Time S e q u e n c e x [ n ] f o r a>0 ’ ) subplot (3 . a . XW1_Mag ) . [ XW1_Phase . a . title ( ’ Phase R e s p o n s e <(X(jW) ) ’ ) // p l o t f o r a<0 figure 118 . x2 = x2 ’. [ XW2_Phase . a .n .sqrt ( -1) *n ’* W ) . x_location = ” o r i g i n ” . XW2_Mag = [ mtlb_fliplr ( XW2_Mag ) . plot2d3 ( ’ gnn ’ .2) .1 . XW1_Phase ) . XW2_Phase (2:1001) ]. W = [ . db ] = phasemag ( XW1 ) . x1 ) . a . y_location = ” o r i g i n ” . W (2:1001) ]. XW1_Mag (2:1001) ].1 . W = k * Wmax / K . x_location = ” o r i g i n ” . plot2d (W .1 .mtlb_fliplr ( XW1_Phase ) . // Omega from − Wmax t o Wmax XW1_Mag = [ mtlb_fliplr ( XW1_Mag ) .

1 . a = gca () . XW2_Mag ) .52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 subplot (3 . plot2d (W . a . a . x_location = ” o r i g i n ” . y_location = ” o r i g i n ” .1 . x2 ) .2) .3) . plot2d (W . XW2_Phase ) . title ( ’ Magnitude R e s p o n s e a b s (X(jW) ) ’ ) subplot (3 .1) .n . a = gca () .1 . a . x_location = ” o r i g i n ” . xtitle ( ’ D i s c r e t e Time S e q u e n c e x [ n ] f o r a>0 ’ ) subplot (3 . y_location = ” o r i g i n ” . title ( ’ Phase R e s p o n s e <(X(jW) ) ’ ) 119 . plot2d3 ( ’ gnn ’ . a .

1 120 .1: Results of Exa 5.Figure 5.

1 Example 5. 2 : D i s c r e t e Time F o u r i e r T r a n s f o r m o f 2 // x [ n ]= ( a ˆ a b s ( n ) ) a>0 and a<0 3 clear . 8 max_limit = 10.Figure 5. 6 // DTS S i g n a l 7 a = 0. 4 clc .5.max_limit +1: max_limit -1.2 Discrete Time Fourier Transform of x[n] = (aa bs(n))a > 0anda < 0 1 // Example 5 . 9 n = . 5 close .2: Results of Exa 5. 121 .

1) . W = k * Wmax / K . title ( ’ D i s c r e t e Time F o u r i e r T r a n s f o r m X( exp (jW) ) ’ ) 122 . a = gca () . a . XW_Mag ) . x_location = ” o r i g i n ” . // Omega from − Wmax t o Wmax XW_Mag = [ mtlb_fliplr ( XW_Mag ) . a = gca () . plot2d (W . plot2d3 ( ’ gnn ’ .n . XW_Mag = real ( XW ) . // p l o t f o r a b s ( a ) <1 figure subplot (2 .mtlb_fliplr ( W ) .sqrt ( -1) *n ’* W ) . K = 4. y_location = ” o r i g i n ” . a .1 .10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 x = a ^ abs ( n ) . XW = x * exp ( . y_location = ” o r i g i n ” .1 . a . W = [ . a . xtitle ( ’ D i s c r e t e Time S e q u e n c e x [ n ] f o r a>0 ’ ) subplot (2 . k = 0:( K /1000) : K . W (2:1001) ]. x_location = ” o r i g i n ” .2) . x ) . // D i s c r e t e −t i m e F o u r i e r T r a n s f o r m Wmax = 2* %pi . XW_Mag (2:1001) ].

clc . length ( n ) ) . 3 : D i s c r e t e Time F o u r i e r T r a n s f o r m o f // x [ n ]= 1 .Figure 5. a b s ( n )<=N1 clear . // D i s c r e t e −t i m e F o u r i e r T r a n s f o r m 123 .3: Results of Exa 5.3 Discrete Time Fourier Transform of x[n] = 1.N1 : N1 .2 Example 5. close . abs(n) <= N 1 1 2 3 4 5 6 7 8 9 10 // Example 5 . // DTS S i g n a l N1 = 2. x = ones (1 . n = .

XW_Mag ) . XW_Mag = real ( XW ) . W (2:1001) ]. // Omega from − Wmax t o Wmax XW_Mag = [ mtlb_fliplr ( XW_Mag ) . W = [ .1 . a .1) . plot2d (W . y_location = ” o r i g i n ” .mtlb_fliplr ( W ) .1 .2) . x_location = ” o r i g i n ” . title ( ’ D i s c r e t e Time F o u r i e r T r a n s f o r m X( exp (jW) ) ’ ) 124 . a = gca () . plot2d3 ( ’ gnn ’ . x_location = ” o r i g i n ” . xtitle ( ’ D i s c r e t e Time S e q u e n c e x [ n ] ’ ) subplot (2 . k = 0:( K /1000) : K . // p l o t f o r a b s ( a ) <1 figure subplot (2 . y_location = ” o r i g i n ” . x ) . a = gca () .11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Wmax = 2* %pi . W = k * Wmax / K . XW_Mag (2:1001) ]. a . XW = x * exp ( .sqrt ( -1) *n ’* W ) . a .n . K = 4. a .

Figure 5. Wo ]. clc .3 Example 5.4: Results of Exa 5. close . 5 : D i s c r e t e Time F o u r i e r T r a n s f o r m : x [ n ]= c o s (nWo) clear . W = [ . XW =[ %pi .0 .Wo .5 Discrete Time Fourier Transform: x[n] = cos(nW o) 1 2 3 4 5 6 7 8 9 // Example5 . Wo = 2* %pi / N . %pi ]. // 125 .0 . N = 5.

W . 17 xlabel ( ’ W’ ) . 13 a . 16 poly1 . XW . 15 poly1 = a . thickness = 3.10 figure 11 a = gca () . 18 title ( ’DTFT o f c o s (nWo) ’ ) 19 disp ( Wo ) 126 . children (1) . 14 plot2d3 ( ’ gnn ’ .2) . x_location = ” o r i g i n ” . children (1) . 12 a . y_location = ” o r i g i n ” .

clc .5: Results of Exa 5.5 Example 5. x = [1 xn xn xn xn xn xn ].Figure 5. 127 . 6 : D i s c r e t e Time F o u r i e r T r a n s f o r m o f // P e r i o d i c I m p u l s e T r a i n clear . xn = [ zeros (1 .6 Discrete Time Fourier Transform of Periodic Impulse Train 1 2 3 4 5 6 7 8 9 10 // Example5 .N -1) .1]. N1 = -3* N :3* N . N = 5. close . ak = 1/ N .

2* N ) . poly1 . plot2d3 ( ’ gnn ’ . a . children (1) . poly1 . figure subplot (2 . xlabel ( ’ n ’ ).N1 . title ( ’ P e r i o d i c I m p u l s e T r a i n ’ ) subplot (2 . children (1) .11 12 13 14 15 16 17 18 19 20 21 22 23 XW = 2* %pi * ak * ones (1 . a . x_location = ” o r i g i n ” . y_location = ” o r i g i n ” . n = -N :N -1.1) a = gca () . XW . plot2d3 ( ’ gnn ’ . children (1) . 33 title ( ’DTFT o f P e r i o d i c I m p u l s e T r a i n ’ ) 34 disp ( Wo ) 128 . thickness = 3. xlabel ( ’ 24 25 26 27 28 29 30 31 32 W’ ) .2) a = gca () . W = Wo * n . y_location = ” o r i g i n ” . a .2) . poly1 = a . poly1 = a .1 . thickness = 3. x_location = ” o r i g i n ” .2) . children (1) .W .x .1 . Wo = 2* %pi / N . a .

close .6 Example 5. clc . // Passband o f f i l t e r H0 = 1.Wc :0.1: Wc . Wc = 1.6: Results of Exa 5. // 1 r a d / s e c W = . // Magnitude o f F i l t e r 129 .Figure 5.7 Frequency Shifting Property of DTFT:Frequency Response of Ideal Low pass Filter and HPF 1 2 3 4 5 6 7 // Example 5 . 7 : F r e q u e n c y S h i f t i n g P r o p e r t y o f DTFT : F r e q u e n c y R e s p o n s e o f I d e a l Low p a s s F i l t e r and HPF clear .

x_location = ” o r i g i n ” .%pi .2* %pi . HlpW ) . x_location = ” o r i g i n ” . a . y_location = ” o r i g i n ” . Whp1 = W + %pi .0.1 . Whp2 = -W . data_bounds =[ . a . figure subplot (2 . plot2d ( Whp2 .2]. plot2d (W .1 . HlpW ) . a .0. length ( W ) ) .8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 HlpW = H0 * ones (1 . plot2d ( Whp1 .%pi .1) a = gca () . a . y_location = ” o r i g i n ” . a . a .2]. xtitle ( ’ F r e q u e n c y R e s p o n s e o f HPF H( exp (jW) ) ’ ) 130 .2) a = gca () . HlpW ) . %pi . xtitle ( ’ F r e q u e n c y R e s p o n s e o f LPF H( exp (jW) ) ’ ) subplot (2 . data_bounds =[ -2* %pi .

9 : Time E x p a n s i o n P r o p e r t y o f DTFT clear . 131 . y_2_n (1:2:2* length ( y ) ) = y .1 .1 . y = [1 .2* length ( y ) +1) . n = -1:11.1]. clc . y_2_n = [0 y_2_n 0].0].9 Time Expansion Property of DTFT 1 2 3 4 5 6 7 8 9 10 // Example 5 .0 .1 .2 .2 .2 .1 .7 Example 5.1 .2 .7: Results of Exa 5. x = [0 . close .2 .Figure 5.1 . y_2_n = zeros (1 .1 .1 .

n .n . 13 y = [0 .n .n . y_2_n (1: $ -1) ]. zeros (1 .7) ]. 12 x_r = y_2_n +2* y_2_n_1 .y .2) 19 plot2d3 ( ’ gnn ’ .1 . 14 figure 15 subplot (4 .1 .4) 25 plot2d3 ( ’ gnn ’ .1) 16 plot2d3 ( ’ gnn ’ .1 .3) 22 plot2d3 ( ’ gnn ’ . y_2_n ) 20 title ( ’ y ( 2 ) [ n ] ’ ) 21 subplot (4 .11 y_2_n_1 = [0 .1 . y ) 17 title ( ’ y [ n ] ’ ) 18 subplot (4 . y_2_n_1 ) 23 title ( ’ y ( 2 ) [ n −1] ’ ) 24 subplot (4 . x ) 26 title ( ’ x [ n ]= y ( 2 ) [ n ]+2∗ y ( 2 ) [ n −1] ’ ) 132 .

1: Wc . length ( W ) ) .Wc :0. // Passband o f f i l t e r H0 = 1.12 IDTFT:Impulse Response of Ideal Low pass Filter 1 2 3 4 5 6 7 8 9 // Example 5 . // I n v e r s e D i s c r e t e −t i m e F o u r i e r T r a n s f o r m 133 .8: Results of Exa 5. clc . 1 2 : IDTFT : I m p u l s e R e s p o n s e o f I d e a l Low pass F i l t e r clear . // Magnitude o f F i l t e r HlpW = H0 * ones (1 .Figure 5.9 Example 5. Wc = 1. // 1 r a d / s e c W = . close .

poly1 = a . y_location = ” o r i g i n ” . a .2]. a . plot2d3 ( ’ gnn ’ .2) . a . a . a . a .1 . poly1 = a .10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 t = -2* %pi :2* %pi / length ( W ) :2* %pi . -1. y_location = ” o r i g i n ” . children (1) . data_bounds =[ .2) a = gca () . children (1) .2]. figure subplot (2 .t . %pi . HlpW . thickness = 3. plot2d (W . children (1) . thickness = 3. data_bounds =[ -2* %pi .1) a = gca () . poly1 . ht = real ( ht ) . xtitle ( ’ F r e q u e n c y R e s p o n s e o f LPF H( exp (jW) ) ’ ) subplot (2 .0.2* %pi .%pi . children (1) . ht ) . xtitle ( ’ I m p u l s e R e s p o n s e o f LPF h ( t ) ’ ) 134 . x_location = ” o r i g i n ” . ht =(1/(2* %pi ) ) * HlpW * exp ( sqrt ( -1) *W ’* t ) .1 . poly1 . x_location = ” o r i g i n ” .

K = 1. n = 1:100. 135 . 1 5 : M u l t i p l i c a t i o n P r o p e r t y o f DTFT clear .Figure 5.5* %pi * n ) . sin (0.12 Example 5. clc .9: Results of Exa 5.75* %pi * n ) . x1 = [1/2 . Wmax = %pi . sin (0.* x2 . x2 = [3/4 . x = x1 ./( %pi * n ) ].15 Multiplication Property of DTFT 1 2 3 4 5 6 7 8 9 10 // Example5 . close ./( %pi * n ) ].

a .2) a = gca () . title ( ’DTFT X2 ( exp (jW) ) ’ ) . plot (W .1 . XW_Mag ) .3) a = gca () . subplot (3 . a . y_location = ” o r i g i n ” . XW1 = x1 * exp ( . XW2_Mag ) . XW2_Mag (2: $ ) ].1 .sqrt ( -1) *n ’* W ) .sqrt ( -1) *n ’* W ) .11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 k = 0:( K /1000) : K . title ( ’ M u l t i p l i c a t i o n P r o p e r t y o f DTFT ’ ) . x_location = ” o r i g i n ” . a . plot (W . W (2: $ ) ]. a . XW1_Mag (2: $ ) ]. x_location = ” o r i g i n ” .1) a = gca () . XW2 = x2 * exp ( . a . XW_Mag = real ( XW ) . XW2_Mag = real ( XW2 ) . x_location = ” o r i g i n ” . y_location = ” o r i g i n ” . 136 .1 .sqrt ( -1) *n ’* W ) . plot (W . a . XW1_Mag ) . XW = x * exp ( . XW_Mag = [ mtlb_fliplr ( XW_Mag ) . XW2_Mag = [ mtlb_fliplr ( XW2_Mag ) . n = 0:100. subplot (3 . XW_Mag (2: $ ) ]. figure subplot (3 . title ( ’DTFT X1 ( exp (jW) ) ’ ) . XW1_Mag = real ( XW1 ) . W = k * Wmax / K . W = [ .mtlb_fliplr ( W ) . // Omega from −Wmax t o Wmax XW1_Mag = [ mtlb_fliplr ( XW1_Mag ) . y_location = ” o r i g i n ” .

10: Results of Exa 5.Figure 5.15 137 .

tuo1 = 0.033.1:400. clc . tuo3 = 0. w2 = 943. w3 = 1888.Chapter 6 Time and Frequency Characterization of Signals and Systems 6.058.1 Scilab Codes Example 6. tuo2 = 0. f1 = 50.066. f = 0:0. f3 = 300. close . W = 2* %pi * f . f2 = 150. for i =1: length ( f ) 138 .1 Phase Response and Group Delay 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 // Example6 . 1 : Phase R e s p o n s e and Group D e l a y clear . w1 = 315.

den3 ( i ) = (1+( sqrt ( -1) * f ( i ) / f3 ) ^2+2* sqrt ( -1) * tuo3 *( f ( i ) / f3 ) ) .001 -( f ( i ) / f2 ) ^2) ) . phase1 ( i ) = -2* atan ((2* tuo1 *( f ( i ) / f1 ) ) /(1.phase_total ( i ) *0. den2 ( i ) = (1+( sqrt ( -1) * f ( i ) / f2 ) ^2+2* sqrt ( -1) * tuo2 *( f ( i ) / f2 ) ) .1/ %pi .001 -( f ( i ) / f2 ) ^2) ) .001 -( f ( i ) / f1 ) ^2) ) . HW ( i ) = H_W ( i ) * H3W ( i ) . num2 ( i ) = (1+( sqrt ( -1) * f ( i ) / f2 ) ^2 -2* sqrt ( -1) * tuo2 *( f ( i ) / f2 ) ) . // d e l t a f= 0.001 -( f ( i ) / f2 ) ^2) ) . phase_total ( i ) = phase1 ( i ) + phase2 ( i ) + phase3 ( i ) .001 -( f ( i ) / f1 ) ^2) ) .1 elseif ( f ( i ) >=50 & f ( i ) <=150) W_phase1 ( i ) = -2* %pi -2* atan ((2* tuo1 *( f ( i ) / f1 ) ) /(1. H3W ( i ) = num3 ( i ) / den3 ( i ) . group_delay ( i ) = . den1 ( i ) = (1+( sqrt ( -1) * f ( i ) / f1 ) ^2+2* sqrt ( -1) * tuo1 *( f ( i ) / f1 ) ) . H1W ( i ) = num1 ( i ) / den1 ( i ) . W_phase2 ( i ) = -2* atan ((2* tuo2 *( f ( i ) / f2 ) ) /(1. 139 . num3 ( i ) = (1+( sqrt ( -1) * f ( i ) / f3 ) ^2 -2* sqrt ( -1) * tuo3 *( f ( i ) / f3 ) ) .17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 num1 ( i ) = (1+( sqrt ( -1) * f ( i ) / f1 ) ^2 -2* sqrt ( -1) * tuo1 *( f ( i ) / f1 ) ) . H2W ( i ) = num2 ( i ) / den2 ( i ) . if ( f ( i ) <=50) W_phase1 ( i ) = -2* atan ((2* tuo1 *( f ( i ) / f1 ) ) /(1.001 -( f ( i ) / f1 ) ^2) ) . W_phase3 ( i ) = -2* atan ((2* tuo3 *( f ( i ) / f3 ) ) /(1. W_phase2 ( i ) = -2* atan ((2* tuo2 *( f ( i ) / f2 ) ) /(1. phase3 ( i ) = -2* atan ((2* tuo3 *( f ( i ) / f3 ) ) /(1. phase2 ( i ) = -2* atan ((2* tuo2 *( f ( i ) / f2 ) ) /(1.001 -( f ( i ) / f3 ) ^2) ) .001 -( f ( i ) / f3 ) ^2) ) . H_W ( i ) = H1W ( i ) * H2W ( i ) .

001 -( f ( i ) / f1 ) ^2) ) . group_delay ( i ) = .2) xtitle ( ’ unwrapped p h a s e ’ .001 -( f ( i ) / f2 ) ^2) ) . else W_phase_total ( i ) = W_phase1 ( i ) + W_phase2 ( i ) + W_phase3 ( i ) . ’ Phase ( r a d ) ’ ). figure plot2d (f .phase_total ( i ) *0.001 -( f ( i ) / f1 ) ^2) ) . W_phase_total . W_phase3 ( i ) = -2* atan ((2* tuo3 *( f ( i ) / f3 ) ) /(1.001 -( f ( i ) / f3 ) ^2) ) .001 -( f ( i ) / f3 ) ^2) ) . end end figure plot2d (f .40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 W_phase3 ( i ) = -2* atan ((2* tuo3 *( f ( i ) / f3 ) ) /(1. W_phase3 ( i ) = -6* %pi -2* atan ((2* tuo3 *( f ( i ) / f3 ) ) /(1. W_phase2 ( i ) = -4* %pi -2* atan ((2* tuo2 *( f ( i ) / f2 ) ) /(1. W_phase2 ( i ) = -2* atan ((2* tuo2 *( f ( i ) / f2 ) ) /(1. end if ( f ( i ) ==300. ’ F r e q u e n c y ( Hz ) ’ . elseif ( f ( i ) >300 & f ( i ) <=400) W_phase1 ( i ) = -2* atan ((2* tuo1 *( f ( i ) / f1 ) ) /(1. ’ F r e q u e n c y ( Hz ) ’ .1/(4* %pi ) .phase_total ( i ) *0.1/(2* %pi ) . phase_total . elseif ( f ( i ) >=150 & f ( i ) <=300) W_phase1 ( i ) = -2* atan ((2* tuo1 *( f ( i ) / f1 ) ) /(1. group_delay ( i ) = .001 -( f ( i ) / f2 ) ^2) ) .001 -( f ( i ) / f3 ) ^2) ) .1/(4* %pi ) .1) W_phase_total ( i ) = 2* %pi + W_phase1 ( i ) + W_phase2 ( i ) + W_phase3 ( i ) . ’ Phase ( r a d ) ’ ).phase_total ( i ) *0.2) 140 . group_delay ( i ) = . figure plot2d (f . abs ( group_delay ) .2) xtitle ( ’ P r i n c i p a l p h a s e ’ .

’ Group D e l a y ( s e c ) ’ ).1 141 .67 xtitle ( ’ g r o u p d e l a y ’ .1: Results of Exa 6. Figure 6. ’ F r e q u e n c y ( Hz ) ’ .

2: Results of Exa 6.Figure 6.1 142 .

5 close .1 Example 6.500) .500) .0.3 Analog Lowpass IIR filter design Cutoff frequency Fc = 500Hz Passband ripple 1-0.05 and stopband ripple = 0. 6 clc .05 . 8 hs_ellip = analpf (5 .[0.05] .Figure 6.1:2000.05 1 // Example6 . ’ e l l i p ’ . ’ b u t t ’ .0. 143 .05] .3: Results of Exa 6. 3 : Analog Lowpass I I R f i l t e r d e s i g n 2 // C u t o f f f r e q u e n c y Fc = 500 Hz 3 // Passband r i p p l e 1 −0.05 .05 and s t o p b a n d r i p p l e = 0 . 0 5 4 clear . 9 fr =0:.[0. 7 hs_butt = analpf (5 .

hm_ellip ) 22 poly1 = a . 19 poly1 . line_style = 3. 12 hf_ellip = freq ( hs_ellip (2) . foreground = 2. %i * fr ) . 21 plot2d ( fr . children (1) . ’ E l l i p t i c F i l t e r ’ ]) 144 . 18 poly1 .10 hf_butt = freq ( hs_butt (2) . 24 poly1 . children (1) . 11 hm_butt = abs ( hf_butt ) . %i * fr ) . foreground = 5. hs_butt (3) . 23 poly1 . thickness = 2. hm_butt ) 17 poly1 = a . 14 // P l o t t i n g Magnitude R e s p o n s e o f Analog I I R F i l t e r s 15 a = gca () . children (1) . 16 plot2d ( fr . thickness = 2. 13 hm_ellip = abs ( hf_ellip ) . hs_ellip (3) . 20 poly1 . children (1) . 25 xlabel ( ’ F r e q u e n c y ( Hz ) ’ ) 26 ylabel ( ’ Magnitude o f f r e q u e n c y r e s p o n s e ’ ) 27 legend ([ ’ B u t t e r w o r t h F i l t e r ’ .

0. 4 : Bode P l o t 2 s = %s .Figure 6.4: Results of Exa 6. // jw r e p l a c e d by s 5 clf . 6 bode (H .4 Bode Plot 1 // Example 6 .[20000/( s ^2+100* s +10000) ]) .3 Example 6.01 .10000) 145 . 3 // Open Loop T r a n s f e r F u n c t i o n 4 H = syslin ( ’ c ’ .

01 .[(100*(1+ s ) ) /((10+ s ) *(100+ s ) ) ]) . 6 bode (H . // jw r e p l a c e d by s 5 clf . 3 // Open Loop T r a n s f e r F u n c t i o n 4 H = syslin ( ’ c ’ .5 Bode Plot 1 // Example 6 .0.10000) 146 .4 Example 6.5: Results of Exa 6.Figure 6. 5 : Bode P l o t 2 s = %s .

5 147 .Figure 6.6: Results of Exa 6.

phi = . a . a .1 Scilab Codes Example 7. subplot (2 . t = -2:0. Wm = 2* %pi .01:2. a .1) a = gca () . y_location = ” o r i g i n ” .%pi /2.1 Sinusoidal signal 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 // Example7 . x ) title ( ’ c o s (Ws/2∗ t+p h i ) ’ ) subplot (2 . plot (t .1 . 1 : S i n u s o i d a l s i g n a l clear . a .2) a = gca () . Ws = 2* Wm . x = cos (( Ws /2) * t + phi ) . x_location = ” o r i g i n ” . y = sin (( Ws /2) * t ) . clc . 148 .1 . y_location = ” o r i g i n ” .Chapter 7 Sampling 7. x_location = ” o r i g i n ” . close .

21 22

plot (t , y ) title ( ’ s i n (Ws/2∗ t ) ’ )

Figure 7.1: Results of Exa 7.1 Example 7.2 Digital Differentiator
1 // Example7 . 2 : D i g i t a l D i f f e r e n t i a t o r 2 syms t n ; 3 T = 0.1; // S a m p l i n g t i m e i n s e c o n d s 4 xct = sin ( %pi * t / T ) /( %pi * t ) ; 5 yct = diff ( xct , t ) ; 6 disp ( yct , ’ yc ( t )= ’ ) ;

149

7 8 9 10 11 12 13 14

t = n*T; xdn = sin ( %pi * t / T ) /( %pi * t ) ; ydn = diff ( xdn , n ) ; disp ( ydn , ’ yd [ n ]= ’ ) ; hdn = T * ydn ; disp ( hdn , ’ hd [ n ]= ’ ) ; // R e s u l t // yc ( t ) = ( 1 0 ∗ c o s ( 3 1 . 4 1 5 9 2 7 ∗ t ) / t ) − ( 0 . 3 1 8 3 0 9 9 ∗ s i n (31.415927∗ t ) /( t ˆ2) ) 15 // yd [ n ] = ( 1 0 ∗ c o s ( 3 . 1 4 1 5 9 2 7 ∗ n ) / n ) −3.183∗ s i n ( 3 . 1 4 1 5 9 2 7 ∗ n) /(n ˆ2) 16 // hd [ n ] = ( c o s ( 3 . 1 4 1 5 9 2 7 ∗ n ) / n ) −0.3183∗ s i n ( 3 . 1 4 1 5 9 2 7 ∗ n ) /(n ˆ2) Example 7.3 Half Sample Delay system
1 // Example7 . 3 : H a l f Sample D e l a y s y s t e m 2 syms t n T ; 3 //T = 0 . 1 ; // S a m p l i n g t i m e i n s e c o n d s 4 xct = sin ( %pi * t / T ) /( %pi * t ) ; 5 t = t - T /2; 6 yct_del = sin ( %pi * t / T ) /( %pi * t ) ; 7 disp ( yct_del , ’ Output o f H a l f Sample d e l a y s y s t e m

c o n t i n u o u s = ’ );
8 t = n *T - T /2; 9 xdn = sin ( %pi * t / T ) /( %pi * t ) ; 10 ydn_del = xdn ; 11 disp ( ydn_del , ’ Output o f H a l f Sample d e l a y s y s t e m

d i s c r e t e = ’ );
12 hdn = T * ydn_del ; 13 disp ( hdn , ’ I m p u l s e R e s p o n s e o f 14 15 16 17 18

d i s c r e t e time h a l f s a m p l e d e l a y s y s t e m= ’ ) ; // R e s u l t // Output o f H a l f Sample d e l a y s y s t e m c o n t i n u o u s = // s i n ( 3 . 1 4 ∗ ( t−T/ 2 ) /T) / ( 3 . 1 4 ∗ ( t−T/ 2 ) ) // Output o f H a l f Sample d e l a y s y s t e m d i s c r e t e = // s i n ( 3 . 1 4 ∗ ( n∗T−T/ 2 ) /T) / ( 3 . 1 4 ∗ ( n∗T−T/ 2 ) )

150

19

// I m p u l s e R e s p o n s e o f d i s c r e t e t i m e h a l f s a m p l e d e l a y s y s t e m= 20 // T∗ s i n ( 3 . 1 4 ∗ ( n∗T−T/ 2 ) /T) / ( 3 . 1 4 ∗ ( n∗T−T/ 2 ) ) Example 7.4 Finding the period of the sampled signal and Sampling frequency
1

2 3 4 5 6 7 8 9 10

// Example7 . 4 : F i n d i n g t h e p e r i o d o f t h e s a m p l e d signal // and S a m p l i n g f r e q u e n c y clear ; close ; clc ; Wm = 2* %pi /9; N = floor (2* %pi /(2* Wm ) ) disp (N , ’ P e r i o d o f t h e d i s c r e t e s i g n a l ’ ) Ws = 2* %pi / N ; disp ( Ws , ’ The S a m p l i n g f r e q u e n c y c o r r e s p o n d i n g t o t h e period N’) Example 7.5 Multirate Signal Processing:Sampling Rate Conversion (1)Downsampling by 4 (2)Upsampling by 2 (3)Upsampling by 2 and followed by downsampling by 9

1 2 3 4 5 6 7 8 9 10 11

// Example7 . 5 : M u l t i r a t e S i g n a l P r o c e s s i n g : S a m p l i n g Rate C o n v e r s i o n // ( 1 ) Downsampling by 4 // ( 2 ) Upsampling by 2 // ( 3 ) Upsampling by 2 and f o l l o w e d by d o w ns a m p l i n g by 9 clear ; close ; clc ; Wm = 2* %pi /9; //Maximum f r e q u e n c y o f s i g n a l Ws = 2* Wm ; // S a m p l i n g f r e q u e n c y N = floor (2* %pi / Ws ) ; // p e r i o d o f d i s c r e t e s i g n a l // O r i g i n a l d i s c r e t e t i m e s i g n a l g e n e r a t i o n and Magnitude r e s p o n s e 151

W = [ .mtlb_fliplr ( W2 ) .12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 n = 0:0. XW2 = z * exp ( .01:2* N . W1 = [ . K = 4. XW2_Mag = XW2_Mag / max ( XW2_Mag ) . // ( 2 ) Upsampling by 2 and c o r r e s p o n d i n g m a g n i t u d e response n2 = 0:0.sqrt ( -1) * n1 ’* W1 ) . k2 = 0:( K /500) : K . XW = x * exp ( . z = zeros (1 . W2 = k2 * Wmax /(2* K ) . XW_Mag (2:1001) ]. XW4_Mag = real ( XW4 ) . XW2_Mag = real ( XW2 ) . XW4_Mag = XW4_Mag / max ( XW4_Mag ) . // Omega from − Wmax t o Wmax XW4_Mag = [ mtlb_fliplr ( XW4_Mag ) . XW4 = y * exp ( . // ( 3 ) Upsampling by 2 and Downsampling by 9 152 . // ( 1 ) d o wn s a m p l i n g by 4 and c o r r e s p o n d i n g m a g n i t u d e response n1 = 0:0. XW4_Mag (2: $ ) ].sqrt ( -1) * n2 ’* W2 ) . W1 = k1 *4* Wmax / K .01: N .sqrt ( -1) *n ’* W ) .mtlb_fliplr ( W ) . z ([1:2: length ( z ) ]) = x . y = x (1:4: length ( x ) ) . length ( n2 ) ) .01: N /4. k1 = 0:( K /2000) : K . Wmax = 2* %pi /9. XW_Mag = XW_Mag / max ( XW_Mag ) . W2 (2: $ ) ]. W = k * Wmax / K . XW_Mag = real ( XW ) . x = sin ( Wm * n ) . k = 0:( K /1000) : K . W1 (2: $ ) ]. // Omega from − Wmax t o Wmax XW2_Mag = [ mtlb_fliplr ( XW2_Mag ) .mtlb_fliplr ( W1 ) . W (2:1001) ]. W2 = [ . XW2_Mag (2: $ ) ]. // Omega from − Wmax t o Wmax XW_Mag = [ mtlb_fliplr ( XW_Mag ) .

45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78

c o r r e s p o n d i n g magnitude r e s p o n s e n3 = 0:0.01:2* N /9; g = z ([1:9: length ( z ) ]) ; k3 = 0: K /(9*500) : K ; W3 = k3 *9* Wmax /(2* K ) ; XW3 = g * exp ( - sqrt ( -1) * n3 ’* W3 ) ; XW3_Mag = real ( XW3 ) ; XW3_Mag = XW3_Mag / max ( XW3_Mag ) ; W3 = [ - mtlb_fliplr ( W3 ) , W3 (2: $ ) ]; // Omega from − Wmax t o Wmax XW3_Mag = [ mtlb_fliplr ( XW3_Mag ) , XW3_Mag (2: $ ) ]; // figure subplot (2 ,2 ,1) a = gca () ; a . y_location = ” o r i g i n ” ; a . x_location = ” o r i g i n ” ; a . data_bounds =[ - %pi ,0; %pi ,1.5]; plot2d (W , XW_Mag ,5) ; title ( ’ Spectrum o f D i s c r e t e S i g n a l X( exp (jW) ) ’ ) subplot (2 ,2 ,2) a = gca () ; a . y_location = ” o r i g i n ” ; a . x_location = ” o r i g i n ” ; a . data_bounds =[ - %pi ,0; %pi ,1.5]; plot2d ( W1 , XW4_Mag ,5) ; title ( ’ Spectrum o f downsampled s i g n a l by 4 X( exp (jW /4) ) ’ ) subplot (2 ,2 ,3) a = gca () ; a . y_location = ” o r i g i n ” ; a . x_location = ” o r i g i n ” ; a . data_bounds =[ - %pi ,0; %pi ,1.5]; plot2d ( W2 , XW2_Mag ,5) ; title ( ’ Spectrum o f Upsampled s i g n a l by 2 X( exp ( 2jW) ) ’) subplot (2 ,2 ,4) a = gca () ; 153

79 a . y_location = ” o r i g i n ” ; 80 a . x_location = ” o r i g i n ” ; 81 a . data_bounds =[ - %pi ,0; %pi ,1.5]; 82 plot2d ( W3 , XW3_Mag ,5) ; 83 title ( ’ Spectrum o f Upsampled by 2 and Downsampled by

9

X( exp ( 2jW/ 9 ) ) ’ )

Figure 7.2: Results of Exa 7.5

154

Chapter 9 The Laplace Transform
9.1 Scilab Codes

Example 9.1 Lapalce Transform x(t) = exp(−at).u(t)
1 // Example9 . 1 : L a p a l c e T r a n s f o r m x ( t ) = exp (− a t ) . u ( t ) 2 syms t s ; 3 a = 3; 4 y = laplace ( ’ %eˆ(− a ∗ t ) ’ ,t , s ) ; 5 disp ( y ) 6 // R e s u l t 7 // 1 / ( s+a )

Example 9.2 Lapalce Transform x(t) = exp(−at).u(−t)
1 2 3 4 5 6 7

// Example9 . 2 : L a p a l c e T r a n s f o r m x ( t ) = −exp (− a t ) . u(− t ) syms t s ; a =3; y = laplace ( ’ %e ˆ ( a∗− t ) ’ ,t , s ) ; disp ( y ) // R e s u l t // 1 / ( s+a ) Example 9.3 Lapalce Transform x(t) = 3exp(−2t)u(t) − 2exp(−t)u(t) 155

s ) .t . 156 . 4 : L a p a l c e T r a n s f o r m x ( t ) = exp (−2 t ) u ( t )+ exp (− t ) ( c o s 3 t ) u ( t ) syms t s . s ) .1 2 3 4 5 6 // Example9 . y = 1+ y .6 Lapalce Transform x(t) = exp(−at)u(t). disp ( y ) // R e s u l t // [ ( s +1) / ( s ˆ2+2∗ s +10) ] + [ 1 / ( s +2) ] r e f e r equation 9.29 // E q u i v a l e n t t o ( 2 ∗ s ˆ2+5∗ s +12) / ( ( s ˆ2+2∗ s +10) ∗ ( s +2) ) r e f e r equation 9.t . 0<t<T syms t s .t . 5 : L a p a l c e T r a n s f o r m o f x ( t )=s ( t ) −(4/3) exp (− t ) u ( t ) + ( 1 / 3 ) exp ( 2 t ) u ( t ) syms t s . 3 : L a p a l c e T r a n s f o r m x ( t ) = 3 exp (−2 t ) u ( t ) −2exp (− t ) u ( t ) syms t s . 0 < t < T 1 2 3 // Example9 . s ) . y = laplace ( ’ 3∗%eˆ( −2∗ t ) −2∗%eˆ(− t ) ’ .30 Example 9. 6 // L a p a l c e T r a n s f o r m x ( t ) = exp (− a t ) u ( t ) .4 Lapalce Transform x(t) = exp(−2t)u(t) + exp(−t)(cos3t)u(t) 1 2 3 4 5 6 7 // Example9 . disp ( y ) // R e s u l t // ( 3 / ( s +2) ) −(2/( s +1) ) Example 9.5 Lapalce Transform x(t) = s(t)−(4/3)exp(−t)u(t)+(1/3)exp(2t)u(t) 1 2 3 4 5 6 7 // Example9 . y = laplace ( ’ −(4/3) ∗%eˆ(− t ) + ( 1 / 3 ) ∗%e ˆ ( 2 ∗ t ) ’ . disp ( y ) // R e s u l t // [ − 4 / ( 3 ∗ ( s +1) ) ] + [ 1 / ( 3 ∗ ( s −2) ) ]+1 Example 9. y = laplace ( ’ %eˆ( −2∗ t )+%eˆ(− t ) ∗ c o s ( 3 ∗ t ) ’ .

u(t) + exp(bt).abs(t)).8 Inverse Lapalce Transform X(S) = 1/((s + 1)(s + 2)) 1 2 3 4 5 6 7 8 9 10 11 12 // Example9 . 0<t< T // x ( t ) = exp (− b t ) . ” P o l e s o f a s y s t e m=” ) // R e s u l t // −1 and −2 157 . s ) . ”Ch a r a c t e r i s t i c s P o l y n o m i a l=” ) y = roots ( x ) .4 a = 3. disp (x . 8 : I n v e r s e L a p a l c e T r a n s f o r m //X( S ) = 1 / ( ( s +1) ( s +2) ) s = %s . s ) . u ( t )+exp ( b t ) . 8 disp ( y ) 9 // R e s u l t 10 // [ 1 / ( s+a ) ] − [ ( exp (( − s−a ) ∗T) ) / ( s+a ) ] Example 9.(1/(( s +1) *( s +2) ) ) ) . ”G( s )=” ) plzr ( G ) x = denom ( G ) .u(t). y = laplace ( ’ %eˆ(−b∗ t )−%e ˆ ( b∗ t ) ’ . 7 y = laplace ( ’ %eˆ(− a ∗ t )−%eˆ(− a ∗ t ) ∗%eˆ( −( s+a ) ∗T) ’ . disp ( y ) // R e s u l t // [ 1 / ( s+b ) ] − [ 1 / ( s−b ) ] Example 9. disp (y . 0 < t < T x(t) = exp(−bt). 6 // t = T .7 Lapalce Transform x(t) = exp(−b. 7 // L a p a l c e T r a n s f o r m x ( t ) = exp (−b . a b s ( t ) ) .t . u ( t ) . b = 3. disp (G . G = syslin ( ’ c ’ .u(−t) 1 2 3 4 5 6 7 8 9 // Example9 .t . u(− t ) syms t s . 5 T = 10.

s .s .8 Example 9.Figure 9.1: Results of Exa 9. ” f ( t )=” ) // R e s u l t 158 . 9 : I n v e r s e L a p a l c e T r a n s f o r m //X( S ) = 1 / ( ( s +1) ( s +2) ) s = %s . [ A ]= pfss (1/(( s +1) *( s +2) ) ) // p a r t i a l f r a c t i o n o f F ( s ) F1 = ilaplace ( A (1) . disp (F . syms t . t ) F = F1 + F2 .9 Inverse Lapalce Transform X(S) = 1/((s + 1)(s + 2)) 1 2 3 4 5 6 7 8 9 10 // Example9 . t ) F2 = ilaplace ( A (2) .

1 0 : I n v e r s e L a p a l c e T r a n s f o r m //X( S ) = 1 / ( ( s +1) ( s +2) ) Re ( s )< −1 . ” f ( t )=” ) // R e s u l t // −(%eˆ− t ) −(%eˆ −(2∗ t ) ) Example 9. Re(s) < −2 1 2 3 4 5 6 7 8 9 10 11 // Example9 .F1 + F2 .11 Inverse Lapalce Transform X(S) = 1/((s + 1)(s + 2)) − 2 < Re(s) < −1 1 2 3 4 5 6 7 8 9 10 11 // Example9 . 1 1 : I n v e r s e L a p a l c e T r a n s f o r m //X( S ) = 1 / ( ( s +1) ( s +2) ) −2< Re ( s )< −1 s = %s .Re ( s )< −2 s = %s .10 Inverse Lapalce Transform X(S) = 1/((s+1)(s+2))Re(s) < −1. syms t . 1 2 : I n v e r s e L a p a l c e T r a n s f o r m //X( S ) = 1 / ( s + ( 1 / 2 ) ) Re ( s )> −1/2 159 . ” f ( t )=” ) // R e s u l t // %eˆ −(2∗ t )−%eˆ− t Example 9. disp (F . t ) F2 = ilaplace ( A (2) . t ) F = -F1 .s .11 // ( %eˆ− t ) −(%eˆ −(2∗ t ) ) Example 9. disp (F .s .s . syms t . t ) F = . t ) F2 = ilaplace ( A (2) . [ A ]= pfss (1/(( s +1) *( s +2) ) ) // p a r t i a l f r a c t i o n o f F ( s ) F1 = ilaplace ( A (1) .s .12 Inverse Lapalce Transform X(S) = 1/(s + (1/2))Re(s) > −1/2 1 2 // Example9 .F2 . [ A ]= pfss (1/(( s +1) *( s +2) ) ) // p a r t i a l f r a c t i o n o f F ( s ) F1 = ilaplace ( A (1) .

”G( s )=” ) figure plzr ( G2 ) G3 = syslin ( ’ c ’ .(1/( s +1) ) ) .13 Inverse Lapalce Transform X1(S) = 1/(s+1)Re(s) > −1.(1/( s +0. ”G( s )=” ) 6 plzr ( G ) Example 9. 4 G = syslin ( ’ c ’ . 1 3 // I n v e r s e L a p a l c e T r a n s f o r m //X1 ( S ) = 1 / ( s +1) Re ( s )> −1 //X2 ( S ) = 1 / ( ( s +1) ( s +2) ) Re ( s )>−1 s = %s .(1/(( s +1) *( s +2) ) ) ) . syms t . disp ( G1 . disp ( G3 .(1/( s +1) ) -(1/(( s +1) *( s +2) ) ) ) . disp ( G2 . ”G( s )=” ) figure plzr ( G3 ) 160 .3 s = %s . X2(S) = 1/((s + 1)(s + 2))Re(s) > −1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 // Example9 .5) ) ) 5 disp (G . G1 = syslin ( ’ c ’ . ”G( s )=” ) figure plzr ( G1 ) G2 = syslin ( ’ c ’ .

2: Results of Exa 9.Figure 9.13 161 .

Figure 9.3: Results of Exa 9.13

162

Figure 9.4: Results of Exa 9.13 Example 9.14 Lapalce Transform x(t) = t.exp(−at), t > 0, x(t) = (t2 )/2.exp(−at), t > 0
1 2 3 4 5 6 7 8 9

// Example9 . 1 4 : L a p a l c e T r a n s f o r m // x ( t ) = t . exp (− a t ) , t >0 // x ( t ) = ( t ˆ 2 ) / 2 . exp (− a t ) , t >0 s = %s ; syms t ; a =10; x1 = laplace ( ’ t ∗%eˆ( −10∗ t ) ’ ,t , s ) ; disp ( x1 ) x2 = laplace ( ’ ( ( t ˆ 2 ) / 2 ) ∗%eˆ( −10∗ t ) ’ ,t , s ) ; 163

10 11 12 13

disp ( x2 ) // R e s u l t // 1 / ( ( s +10) ˆ 2 ) // 1 / ( ( s +10) ˆ 3 ) Example 9.15 Inverse Lapalce Transform X(S) = (2s2 + 5s + 5)/((s + 1)2 )(s + 2))Re(s) > −1

1 // Example9 . 1 5 : I n v e r s e L a p a l c e T r a n s f o r m 2 //X( S ) = ( 2 s ˆ2+5 s +5) / ( ( s +1) ˆ 2 ) ( s +2) ) Re ( s )>−1 3 s = %s ; 4 syms t ; 5 [ A ]= pfss ((2*( s ^2) +5* s +5) /((( s +1) ^2) *( s +2) ) ) ; //

p a r t i a l f r a c t i o n o f F( s )
6 F1 = ilaplace ( A (1) ,s , t ) 7 F2 = ilaplace ( A (2) ,s , t ) 8 // F3 = i l a p l a c e (A( 3 ) , s , t ) 9 F = F1 + F2 ; 10 disp (F , ” f ( t )=” ) 11 // R e s u l t 12 // ( 2 ∗ t ∗ ( %eˆ− t ) ) −(%eˆ− t ) +(3∗%eˆ −(2∗ t ) )

Example 9.16 Initial Value Theorem of Lapalace Transform
1 2 3 4 5 6 7 8 9 10 11

// Example9 . 1 6 : I n i t i a l V a l u e Theorem o f L a p a l a c e Transform syms s ; num = poly ([12 5 2] , ’ s ’ , ’ c o e f f ’ ) den = poly ([20 14 4 1] , ’ s ’ , ’ c o e f f ’ ) X = num / den disp (X , ”X( s )=” ) SX = s * X ; Initial_Value = limit ( SX ,s , %inf ) ; disp ( Initial_Value , ” x ( 0 )=” ) // R e s u l t // ( 2 ∗ % i n f ˆ3+5∗ % i n f ˆ2+12∗ % i n f ) / ( % i n f ˆ3+4∗ % i n f ˆ2+14∗ % i n f +20) =2 164

19 Analysis and Characterization of LTI System Inverse Lapalce Transform X(S) = (es )/(s + 1) 1 2 3 4 5 6 7 8 9 // Example9 .s . 1 7 : A n a l y s i s and C h a r a c t e r i z a t i o n o f LTI System // L a p a l c e T r a n s f o r m h ( t ) = exp (− t ) . u(− t ) syms t s . disp ( h ) // R e s u l t // 1 / ( s +1) Example 9. u ( t ) syms t s .t . disp (h .t . 1 9 : A n a l y s i s and C h a r a c t e r i z a t i o n o f LTI System // I n v e r s e L a p a l c e T r a n s f o r m //X( S ) = ( e ˆ s ) / ( s +1) syms s t . y = laplace ( ’ %eˆ(− t )−%e ˆ ( t ) ’ .u(t) + exp(t). h = laplace ( ’ %eˆ(− t ) ’ . // I n v e r s e L a p l a c e T r a n s f o r m o f exp ( s ) H2 =1/( s +1) . h2 = ilaplace ( H2 . t ) h = h1 * h2 .17 Analysis and Characterization of LTI System Lapalce Transform h(t) = exp(−t). s ) . h1 = exp ( -1) .Example 9. disp ( y ) // R e s u l t // ( 1 / ( s +1) ) −(1/( s −1) ) Example 9. 1 8 : A n a l y s i s and C h a r a c t e r i z a t i o n o f LTI System // L a p a l c e T r a n s f o r m x ( t ) = exp (− a b s ( t ) ) // x ( t ) = exp (− t ) .18 Analysis and Characterization of LTI System Lapalce Transform x(t) = exp(−abs(t))x(t) = exp(−t). s ) .u(−t) 1 2 3 4 5 6 7 8 // Example9 .u(t) 1 2 3 4 5 6 7 // Example9 . ” h ( t )=” ) 165 . u ( t )+exp ( t ) .

6 6 6 6 6 6 6 ∗ %eˆ(− t ) 16 // R e f e r e q u a t i o n 9 .t . t ) F3 = ilaplace ( B (1) . [ B ] = pfss (1/(( s +1) *( s -2) ) ) .F3 . 2 0 : I n v e r s e L a p a l c e T r a n s f o r m //X( S ) = ( ( s −1) / ( ( s +1) ∗ ( s −2) ) ) s = %s .21 Analysis and Characterization of LTI System Lapalce Transform h(t) = exp(2t)u(t). t ) F4 = ilaplace ( B (2) . 2 1 : A n a l y s i s and C h a r a c t e r i z a t i o n o f LTI System // L a p a l c e T r a n s f o r m h ( t ) = exp ( 2 t ) u ( t ) . Re ( s ) >2 syms t s . ( 1 / 3 ) = 0 . f ( t ) = 0 . X = laplace ( ’ %e ˆ ( 2 ∗ t ) ’ . 3 3 3 3 3 3 4 ∗ exp ( 2 ∗ t ) + 0 . t ) F2 = ilaplace ( A (2) .F4 . e . t ) F = F1 + F2 . [ A ] = pfss ( s /(( s +1) *( s -2) ) ) . 1 2 0 . s ) .s .66666 Example 9.10 11 // R e s u l t // ( 1 8 0 8 9 ∗ ( %eˆ− t ) ) / 4 9 1 7 1 = 0 . disp ( X ) // R e s u l t // 1 / ( s −2) 166 . Re(s) > 2 1 2 3 4 5 6 7 // Example9 . 3 3 3 3 and ( 2 / 3 ) = 0. disp (F .s . F1 = ilaplace ( A (1) . 3 6 7 8 7 9 4 ( %eˆ− t ) Example 9.s .20 Inverse Lapalce Transform X(S) = ((s−1)/((s+1)∗(s−2))) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 // Example9 .s . syms t . ” f ( t )=” ) // R e s u l t // f ( t )= 3 3 3 3 3 3 2 9 9 9 9 9 9 9 ∗ exp ( 2 ∗ t ) / 9 9 9 9 9 9 7 0 0 0 0 0 0 0 + 6 6 6 6 6 6 4 ∗ %eˆ− t / 9 9 9 9 9 9 7 15 // i .

X = laplace ( ’ %eˆ( −3∗ t ) ’ . disp (A . [ A ] = pfss ((2* s ^2+4* s -6) /( s ^2+3* s +2) ) . u ( t ) syms t s . Y = laplace ( ’ %eˆ(− t )−%eˆ( −2∗ t ) ’ . 3 1 : C a u s a l LTI S y s t e m s d e s c r i b e d by d i f f e r e n t i a l equations // and R a t i o n a l System f u n c t i o n s // P a r t i a l F r a c t i o n //H( S ) = ( ( s −1) / ( ( s +1) ∗ ( s −2) ) ) s = %s . disp ( H ) // R e s u l t // ( s +3) ∗ ( 1 / ( s +1) −1/( s +2) ) Example 9. ”H( S )=” ) // R e s u l t H( S )= // // − 8 // −−−−− // 1 + s // 6 // −−−−− // 2 + s // 167 .Example 9. H = Y/X.u(t)y(t) = [exp(−t) − exp(−2t)].t .25 LTI Systems Characterized by Linear Constant Coefficient differential Equation Finding Transfer function H(S) of LTI system x(t) = exp(−3t).t .31 Causal LTI Systems described by differential equations and Rational System functions Partial Fraction H(S) = ((s−1)/((s+1)∗(s−2))) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 // Example9 . u ( t ) // y ( t ) = [ exp (− t )−exp (−2 t ) ] .u(t) 1 2 3 4 5 6 7 8 9 10 11 12 // Example9 . s ) . s ) . syms t . 2 5 : LTI S y s t e m s C h a r a c t e r i z e d by L i n e a r Constant // C o e f f i c i e n t d i f f e r e n t i a l E q u a t i o n // F i n d i n g T r a n s f e r f u n c t i o n H( S ) o f LTI s y s t e m // x ( t ) = exp (−3 t ) .

a = 2. 4 a = 2. disp ( X ) // R e s u l t //%eˆ−a / ( s+a ) Example 9. u ( t ) 3 syms t s . 7 disp ( X ) 8 disp ( Y ) 9 // R e s u l t 10 // ( 2 / s ) +(1/( s −1) ) +1 Example 9.33 Unilateral Laplace Transform:Time Shifting Property x(t) = exp(−a(t + 1)). 6 Y = 1+ X . u ( t +1) syms t s . 3 4 : U n i l a t e r a l L a p l a c e T r a n s f o r m 2 // x ( t ) = s ( t ) +2u ( t )+e ˆ t .u(t) 1 // Example9 . 6 x = ilaplace (X . I n v e r s e Laplace Transform 168 . 3 3 : U n i l a t e r a l L a p l a c e T r a n s f o r m : Time S h i f t i n g Property // x ( t ) = exp (−a ( t +1) ) . X = laplace ( ’ %eˆ(− a ∗ ( t +1) ) ’ .u(t + 1) 1 2 3 4 5 6 7 8 // Example9 .t . 5 X = 1/(( s +1) *( s +2) ) .s .34 Unilateral Laplace Transform x(t) = s(t) + 2u(t) + et . s ) .17 // 2 Example 9. 4 syms t . 3 5 : U n i l a t e r a l 2 //X( S ) = 1 / ( ( s +1) ( s +2) ) 3 s = %s . s ) . t ) .35 Unilateral Inverse Laplace Transform X(S) = 1/((s+1)(s+ 2)) 1 // Example9 . 5 X = laplace ( ’ 2+%e ˆ ( t ) ’ .t .

t ) F = F1 + F2 + F3 disp ( F ) // r e s u l t // (−%eˆ− t ) +((%eˆ −(2∗ t ) ) / 2 ) +(1/2 ) Example 9. 6 disp ( X ) Example 9. // Alpha v a l u e a s s i g n e d a s some c o n s t a n t one [ A ] = pfss ( alpha /( s *( s +1) *( s +2) ) ) . t ) F3 = ilaplace ( A (3) . 4 syms t . 5 [ X ] = pfss ((( s ^2) -3) /( s +2) ) . F1 = ilaplace ( A (1) .s .38 Unilateral Laplace Transform:Solving Differential Equation Y (S) = [beta(s+3)/((s+1)(s+2))]+[gamma/((s+2)(s+2))]+[alpha/(s(s+ 1)(s + 2))] 169 . t ) F2 = ilaplace ( A (2) . alpha = 1. 3 6 : U n i l a t e r a l Laplace Transform 2 //X( S ) = ( ( s ˆ 2 ) −3) / ( s +2) 3 s = %s .7 8 9 10 disp ( X ) disp ( x ) // R e s u l t // ( %eˆ− t ) −(%eˆ −(2∗ t ) ) Example 9.s . syms t .s . 3 7 : U n i l a t e r a l Laplace Transform : S o l v i n g D i f f e r e n t i a l Equation //Y( S ) = a l p h a / ( s ( s +1) ( s +2) ) s = %s .37 Unilateral Laplace Transform:Solving Differential Equation Y (S) = alpha/(s(s + 1)(s + 2)) 1 2 3 4 5 6 7 8 9 10 11 12 13 // Example9 .36 Unilateral Laplace Transform X(S) = ((s2 ) − 3)/(s + 2) 1 // Example9 .

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 // Example9 . 3 8 : U n i l a t e r a l Laplace Transform : S o l v i n g D i f f e r e n t i a l Equation //Y( S ) =[ b e t a ( s +3) / ( ( s +1) ( s +2) ) ] + [ gamma / ( ( s +2) ( s +2) ) ] + [ a l p h a / ( s ( s +1) ( s +2) ) ] s = %s . alpha = 2. t ) disp ( y ) // r e s u l t // ( −%eˆ(− t ) ) +3∗(%eˆ( −(2∗ t ) ) ) +1 170 . Y = Y1 . Y2 = 1/( s +1) .Y2 + Y3 . // i n t i a l c o n d i t i o n gamma_v = -5. // i n i t i a l c o n d i t i o n Y1 = 1/ s . // i n p u t c o n s t a n t beta_B = 3. Y3 = 3/( s +2) . syms t .s . disp ( Y ) y = ilaplace (Y .

n .5) ^( .2 Ztransform of x[n] = −an . clc . syms n z . u[−n −1] // a = 0 . 1 : Z t r a n s f o r m o f x [ n ] = ( a ) ˆ n .5. %inf ) 171 . ” a n s=” ) 7 // R e s u l t 8 // 1 . x = -(0. 5 clear all .1 Scilab Codes Example 10. 5 ∗ ( z ˆ −1) −1) Example 10.0 .Chapter 10 The Z-Transform 10. %inf ) 6 disp (X .n ) X = symsum ( x *( z ^( n ) ) .5. 2 : Z t r a n s f o r m o f x [ n ] = −a ˆ n .u[−n − 1] 1 2 3 4 5 6 7 8 9 // Example 1 0 .n ) ) .1 Ztransform of x[n] = (a)n . 3 a = 0. close .u[n] 1 // Example10 . 4 x =( a ) ^ n 5 X = symsum ( x *( z ^( .1 . a = 0. 0 ∗ ( 2 ˆ ( − %inf −1) ∗ z ˆ(− %inf −1) −1) / ( 1 / ( 2 ∗ z ) −1) 9 // E q u i v a l e n t t o − 1 / ( 0 .n . u [ n ] 2 syms n z .

%inf ) x2 = %e ^( .5∗ z ˆ−1 −1) // The R e g i o n o f C o n v e r g e n c e i s | z | >1/2 Example 10.3 Ztransform of x[n] = 7.n ) ) .n . u [ n ] − 6 .X2 disp (X .(1/3)n .n ) ) .0 . 3 : Z t r a n s f o r m o f x [ n ] = 7 . 4 : Z−t r a n s f o r m o f s i n e s i g n a l syms n z .u[n] − 6. 0 ∗ ( 2 ˆ ( % i n f +1) ∗ z ˆ ( % i n f +1)−2∗ z ) / ( 2 ∗ z −1) // E q u i v a l e n t t o −1∗−2∗ z / ( 2 ∗ z −1) = 1 / ( 1 − 0 . X1 = symsum ( a * x1 *( z ^( .sqrt ( -1) * Wo * n ) X2 = symsum ( a * x2 *( z ^( .5 Z-transform of Impulse Sequence 1 // Example10 .0 .0 .n . x1 =(0.10 11 12 13 disp (X .0 . %inf ) X =(1/(2* sqrt ( -1) ) ) *( X1 .X2 ) disp (X . ( 1 / 2 ) ˆn .0∗(2ˆ( − %inf −1) ∗ z ˆ(− %inf −1) −1) / ( 1 / ( 2 ∗ z ) −1) // E q u i v a l e n t t o −6∗ −1/(0. a = (0. x1 = %e ^( sqrt ( -1) * Wo * n ) . u [ n ] syms n z . ” a n s=” ) // R e s u l t // − 1 .n ) ) .n .33) ^( n ) X1 = symsum (7* x1 *( z ^( . 5 ∗ z ˆ −1) Example 10.(1/2)n . Wo = %pi /4.n . %inf ) X = X1 .5) ^( n ) X2 = symsum (6* x2 *( z ^( .u[n] 1 2 3 4 5 6 7 8 9 10 11 12 // Example 1 0 . ( 1 / 3 ) ˆ n . ” a n s=” ) Example 10. 5 : Z−t r a n s f o r m o f I m p u l s e S e q u e n c e 172 .33) ^ n . %inf ) x2 =(0.4 Z-transform of sine signal 1 2 3 4 5 6 7 8 9 10 // Example10 .n ) ) . ” a n s=” ) // R e s u l t // −6.

n . a = 0.0 .n . 5 / z + 0 .0) .5. ” a n s=” ) // R e s u l t // 0 . 7 : Z t r a n s f o r m o f x [ n ] = bˆ n .6 Ztransform of x[n] = an . %inf ) X = X1 + X2 . x1 =( b ) ^( n ) x2 =( b ) ^( . 5 Example 10.5. 3 X = symsum (1*( z ^( .n ) ) .9 Inverse Z Transform :ROC |z| > 1/3 173 .n ) X1 = symsum ( x1 *( z ^( . b = 0. u [ n ]+ bˆ−n .0 . N =6.0∗(2ˆ( − %inf −1) ∗ z ˆ(− %inf −1) −1) / ( 1 / ( 2 ∗ z ) −1) // E q u i v a l e n t t o − 1 / ( 0 .u[n] + b− n.015625/ z ˆ6+1. ” a n s=” ) // R e s u l t // +1.n .u[−n − 1] 1 2 3 4 5 6 7 8 9 10 11 12 13 // Example 1 0 .n .0 Example 10. 6 : Z t r a n s f o r m o f x [ n ] = a ˆn . disp (X .1 . x =( a ) ^( n ) X = symsum ( x *( z ^( . 4 disp (X . 2 5 / z ˆ 2 + 0 . u [−n −1] syms n z .n ) ) . 0 < n < N − 1 1 2 3 4 5 6 7 8 9 // Example 1 0 . ” a n s=” ) 5 // R e s u l t 6 // 1 Example 10.7 Ztransform of x[n] = bn . 0 6 2 5 / z ˆ 4 + 0 . 0 3 1 2 5 / z ˆ5+0. N ) disp (X .2 syms n z . 0 < n < N −1 syms n z . %inf ) X2 = symsum ( x2 *( z ^( n ) ) . 1 2 5 / z ˆ 3 + 0 .0 . 5 ∗ z ˆ−1 − 1 ) // R e g i o n o f C o n v e r g e n c e | z | > 0 .n ) ) .

X1 = z1 *(3* z1 -(5/6) ) /(( z1 -(1/4) ) *( z1 -(1/3) ) ) F1 = X1 *( z1 ^( n -1) ) *( z1 .zp (2) ) .zp (1) ) . 9 : I n v e r s e Z T r a n s f o r m :ROC | z | >1/3 2 z = %z . zp = roots ( X1 ) .zp (1) ) . ’ h1 [ n ]= ’ ) h2 = limit ( F2 . z1 . //To f i n d o u t I n v e r s e z t r a n s f o r m z must 4 5 6 7 8 9 10 11 12 13 14 15 16 be l i n e a r z = z 1 X = z *(3* z -(5/6) ) /(( z -(1/4) ) *( z -(1/3) ) ) X1 = denom ( X ) . z1 . disp (( h2 ) * ’ u(−n −1) ’ . h1 = limit ( F1 . ’ h2 [ n ]= ’ ) h = h1 + h2 . zp (1) ) . disp ( h2 . zp (2) ) . disp (h . F2 = X1 *( z1 ^( n -1) ) *( z1 . 3 syms n z1 . ’ h [ n ]= ’ ) // // R e s u l t // h [ n ]= u ( n ) /4ˆ n−2∗u ( n −1) /3ˆ n 174 . 1 0 : I n v e r s e Z T r a n s f o r m :ROC 1/4 <| z | <1/3 2 z = %z . zp = roots ( X1 ) . 3 syms n z1 . zp (2) ) . X1 = z1 *(3* z1 -(5/6) ) /(( z1 -(1/4) ) *( z1 -(1/3) ) ) F1 = X1 *( z1 ^( n -1) ) *( z1 . zp (1) ) . z1 . ’ h [ n ]= ’ ) // // R e s u l t // h [ n ]= ( 1 / 4 ) ˆ n + ( 2 / 3 ) ˆ n Example 10. disp ( h1 * ’ u ( n ) ’ . ’ h1 [ n ]= ’ ) h2 = limit ( F2 . ’ h2 [ n ]= ’ ) disp (( h1 ) * ’ u ( n ) ’ -( h2 ) * ’ u ( n−1) ’ . z1 .zp (2) ) . F2 = X1 *( z1 ^( n -1) ) *( z1 . //To f i n d o u t I n v e r s e z t r a n s f o r m z must 4 5 6 7 8 9 10 11 12 13 14 15 16 17 be l i n e a r z = z 1 X = z *(3* z -(5/6) ) /(( z -(1/4) ) *( z -(1/3) ) ) X1 = denom ( X ) .1 // Example10 .10 Inverse Z Transform :ROC 1/4 < |z| < 1/3 1 // Example10 . h1 = limit ( F1 . disp ( h1 .

h1 = limit ( F1 .zp (2) ) .zp (1) ) . ’ h1 [ n ]= ’ ) h2 = limit ( F2 . zp (1) ) . disp (( h2 ) * ’ u(−n −1) ’ . end disp (x . disp ( h1 * ’ u(−n −1) ’ . zp = roots ( X1 ) . 1 2 : I n v e r s e z t r a n f o r m : For F i n i t e duration d i s c r e t e sequence syms z . for i = 1: length ( X ) x ( i ) = X ( i ) *( z ^ n ( i ) ) . zp (2) ) . ’ h2 [ n ]= ’ ) disp ( -( h1 ) * ’ u(−n −1) ’ -( h2 ) * ’ u(−n −1) ’ . F2 = X1 *( z1 ^( n -1) ) *( z1 . z1 . ’ h [ n ]= ’ ) // // R e s u l t // h [ n ]= −u(−n −1) /4ˆ n−2∗u(−n −1) /3ˆ n // E q u i v a l e n t t o h [ n ] = −(1/4) ˆ n .13 Inverse z tranform ofInFinite duration discrete sequence Power Series Method (OR) Long Division Method 175 . z1 . u[−n −1] Example 10. u[−n −1] −2∗(1/3) ˆn . u[− n −1] Example 10. u [ n ] − 2 ∗ ( 1 / 3 ) ˆ n .12 Inverse z tranform:For Finite duration discrete sequence 1 2 3 4 5 6 7 8 // Example10 . 3 syms n z1 . X1 = z1 *(3* z1 -(5/6) ) /(( z1 -(1/4) ) *( z1 -(1/3) ) ) F1 = X1 *( z1 ^( n -1) ) *( z1 . n = -2:1. 1 1 : I n v e r s e Z T r a n s f o r m :ROC | z | <1/4 2 z = %z . //To f i n d o u t I n v e r s e z t r a n s f o r m z must 4 5 6 7 8 9 10 11 12 13 14 15 16 17 be l i n e a r z = z 1 X = z *(3* z -(5/6) ) /(( z -(1/4) ) *( z -(1/3) ) ) X1 = denom ( X ) . ’ x [ n ]= ’ ) Example 10. X = [4* z ^2 0 2 3* z ^ -1].17 // E q u i v a l e n t t o h [ n ] = ( 1 / 4 ) ˆ n .11 Inverse Z Transform :ROC |z| < 1/4 1 // Example10 .

u [ n] Y = -z * diff (X .5) Example 10. 6 zp = roots ( X1 ) . x =( a ) ^ n X = symsum ( x *( z ^( . 5 ˆ n . //To f i n d o u t I n v e r s e z t r a n s f o r m z must be l i n e a r z = z 1 4 X = z *( z -(3/2) ) /(( z -(1/3) ) *( z -(1/2) ) ) 5 X1 = denom ( X ) . 0 ∗ ( 2 ˆ ( − %inf −1) ∗ z ˆ(− %inf −1) −1) / ( 1 / ( 2 ∗ z ) −1) //Y( z ) = −1. a = 0. 1 8 : Z t r a n s f o r m − D i f f e r e n t i a t i o n P r o p e r t y // x [ n ] = ( a ) ˆ n . X = ldiv (z .5. ” a n s=” ) // R e s u l t //X( z ) = 1 .1 2 3 4 5 // Example10 . 7 X1 = z1 *( z1 -(3/2) ) /(( z1 -(1/3) ) *( z1 -(1/2) ) ) 176 .z -a . 5 ∗ z ˆ −1/((1 −0. 3 syms n z1 . 1 9 : Z T r a n s f o r m : I n i t i a l V a l u e Theorem 2 z = %z . %inf ) X1 = -1/((1/(2* z ) ) -1) // z t r a n s f o r m o f 0 . ” a n s=” ) disp (Y .19 Z Transform : Initial Value Theorem 1 // Example10 . 1 3 : I n v e r s e z t r a n f o r m o f I n F i n i t e duration d i s c r e t e sequence // Power S e r i e s Method (OR) // Long D i v i s i o n Method z = %z .0 .n .u[n] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // Example10 . z ) // D i f f e r e n t i a t i o n p r o p e r t y o f z− transform disp (X .n ) ) . u [ n ] syms n z .0∗( − %inf −1) ∗2ˆ( − %inf −1) ∗ z ˆ(− %inf −1) / ( 1 / ( 2 ∗ z ) −1) //Y1 ( z ) = 1 / ( 2 ∗ ( 1 / ( 2 ∗ z ) −1) ˆ2∗ z ) // E q u i v a l e n t t o Y1 ( z ) = 0 . a = 2.18 Ztransform-Differentiation Property x[n] = (a)n .5∗ z ˆ −1) ˆ 2 ) Example 10.

23 Inverse Z Transform H(z) =z/z-a 1 2 3 4 5 6 7 8 // Example10 . F = H * z ^( n -1) *( z . z1 . F2 = H2 * z ^( n -1) *( z -(1/2) ) .zp (2) ) . H = z /( z .z . H2 = (1/3) /( z -(1/2) ) . z1 .zp (1) ) .a ) . disp (h . F1 = H1 * z ^( n -1) *( z -(1/2) ) . 2 3 : I n v e r s e Z T r a n s f o r m H( z ) =z / z−a // z = %z .0) . ’ x [ n ]= ’ ) x_initial = limit (x . syms n z .n .8 9 10 11 12 13 14 15 16 17 18 F1 = X1 *( z1 ^( n -1) ) *( z1 . x2 = limit ( F2 . disp ( h1 . x1 = limit ( F1 . h1 = limit ( F1 . I n i t i a l V a l u e Example 10. x = x1 + x2 . H1 = z /( z -(1/2) ) . a ) . zp (2) ) . ’ h1 [ n ]= ’ ) 177 . disp (x . F2 = X1 *( z1 ^( n -1) ) *( z1 .z .25 LTi Systems characterized by Linear Constant Coefficient Difference equations Inverse Z Transform 1 2 3 4 5 6 7 8 9 10 11 // Example10 . a = 2. h = limit (F . disp ( x_initial .a ) .1/2) . zp (1) ) . ’ h [ n ]= ’ ) Example 10. syms n z . ’ x [ 0 ] = ’ ) // // R e s u l t // x [ n ]= 7 / 3 ˆ n −3∗2ˆ(1 −n ) // x [ 0 ] = 1 . 2 5 : LTi S y s t e m s c h a r a c t e r i z e d by L i n e a r Constant // C o e f f i c i e n t D i f f e r e n c e e q u a t i o n s // I n v e r s e Z T r a n s f o r m // z = %z .

’ h2 [ n ]= ’ ) 14 h = h1 + h2 . ” a n s=” ) // R e s u l t //X( z )= 0 . s = %s .n .5.n ) ) .u[n + 1] 1 2 3 4 5 6 7 8 9 10 // Example10 .5. 5 ∗ ( 2 ˆ ( − %inf −1) ∗ z ˆ(− %inf −1)−2∗ z ) / ( 1 / ( 2 ∗ z ) −1) // E q u i v a l e n t t o z / ( 1 − 0 . a = 0.33 Differentiation Property of Unilateral Ztransform x[n] = (a)( n + 1).34 Unilateral Ztransform. 3 3 : D i f f e r e n t i a t i o n P r o p e r t y o f U n i l a t e r a l Ztransform // x [ n ] = ( a ) ˆ ( n+1) . %inf ) disp (X .partial fraction X(z) = (3 − (5/6) ∗ (z − 1))/((1 − (1/4) ∗ (z − 1)) ∗ (1 − (1/3) ∗ (z − 1))) 1 2 3 4 5 6 7 // Example10 . a = 0. -1 . syms n t . u [ n +1] syms n z .12 h2 = limit ( F2 . 15 disp (h . 3 4 : U n i l a t e r a l Z t r a n s f o r m − p a r t i a l fraction // X( z ) =(3 −(5/6) ∗ ( z ˆ −1) ) / ( ( 1 − ( 1 / 4 ) ∗ ( z ˆ −1) ) ∗ ( 1 − ( 1 / 3 ) ∗ ( z ˆ −1) ) ) z = %z . ’ h [ n ]= ’ ) 16 // R e s u l t 17 // h [ n ]= [ ( 1 / 2 ) ˆ n ] + [ 2 ˆ (1 − n ) ] / 3 18 // Which i s E q u i v a l e n t t o h [ n ] = [ ( 1 / 2 ) ˆ n ] + [ ( 1 / 2 ) ˆ ( n −1) ] / 3 Example 10. x =( a ) ^( n +1) X = symsum ( x *( z ^( . [ A ]= pfss ((3 -(5/6) *( z ^ -1) ) /((1 -(1/4) *( z ^ -1) ) *(1 -(1/3) *( z ^ -1) ) ) ) 178 .1/2) . 13 disp ( h2 . 5 ∗ z ˆ −1) Example 10.z .

y1 = limit ( F1 . 3 6 : To f i n d o u t p u t r e s p o n s e o f an LTI System syms n z . F2 = Y *( z ^( n -1) ) *( z +3) .3333333 + z 0. H = z /( z +3) X = z /( z -1) Y = X*H F1 = Y *( z ^( n -1) ) *( z -1) .36 Output response of an LTI System 0. ” a n s=” ) disp ( x3 .0833333 − 0.6666667 −−−−−−−−−−−−− − 0.z ) x2 = horner ( A (2) .z ) x3 = A (3) x = x1 + x2 + x3 disp ( x1 .5833333 z + z Example 10.8333333 z + 3z // −−−−−−−−−−−−−−−−−−−−−−−−− // 2 // 0. ” a n s=” ) disp (x . g i v e s t h e o r i g i n a l v a l u e // 2 // − 0. 179 . ” a n s=” ) disp ( x2 .1) .25 −−−−−−−− − 0.8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 x1 = horner ( A (1) . ” a n s=” ) // R e s u l t // // // // // // // 3 // sum o f t h e s e .z .25 + z 1 2 3 4 5 6 7 8 // Example 1 0 .

F2 = Y2 *( z ^( n -1) ) *( z +3) . y3 = limit ( F3 .z . u [ n ] Example 10. // i n i t i a l c o n d i t i o n y [ − 1 ] = 1 Y1 = -((3* beta_b * z ) /( z +3) ) Y2 = ( alpha * z ^2/(( z +3) *( z -1) ) ) F1 = Y1 *( z ^( n -1) ) *( z +3) . y1 = limit ( F1 .37 Output response of an LTI System 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // Example 1 0 . -3) . // i n p u t c o n s t a n t beta_b = 1. y2 = limit ( F2 .z . ’ y [ n ]= ’ ) 11 // R e s u l t 12 // y [ n ] = u ( n ) /4 −( −3) ˆ ( n+1) ∗u ( n ) /4 13 // E q u i v a l e n t t o = ( 1 / 4 ) . F3 = Y2 *( z ^( n -1) ) *( z -1) . disp (( y1 + y2 + y3 ) * ’ u ( n ) ’ .z . 3 7 : To f i n d o u t p u t r e s p o n s e o f an LTI System syms n z . -3) . -3) .1) .9 y2 = limit ( F2 . 10 disp ( y1 * ” u ( n ) ” + y2 * ” u ( n ) ” .z . alpha = 8. u [ n ] − ( 3 / 4 ) ( −3) ˆ n . ’ y [ n ]= ’ ) // R e s u l t // y [ n ] = (2 −( −3) ˆ ( n+1) ) ∗u ( n ) 180 .

H = syslin ( ’ c ’ . evans (F .1 Root locus Analysis of Linear Feedback Systems Continuous Time Systems 1 2 3 4 5 6 7 8 9 // Example11 .Chapter 11 Linear Feedback Systems 11. 1 : Root l o c u s A n a l y s i s o f L i n e a r Feedback Systems // C o n t i n u o u s Time S y s t e m s // R e f e r f i g u r e 1 1 . clf . G = syslin ( ’ c ’ .1 Scilab Codes Example 11. F = G*H.[1/( s +1) ]) .[1/( s +2) ]) . 1 2 ( a ) i n Openhiem &W i l l k s y p a g e 840 s = %s .3) 181 .

1 4 ( a ) i n Openhiem &W i l l k s y p a g e 844 s = %s . clf .2 Root locus Analysis of Linear Feedback Systems Continuous Time Systems 1 2 3 4 5 6 7 // Example11 .1: Results of Exa 11.2) 182 . 2 : Root l o c u s A n a l y s i s o f L i n e a r Feedback Systems // C o n t i n u o u s Time S y s t e m s // R e f e r f i g u r e 1 1 . evans (G .Figure 11. G = syslin ( ’ c ’ .[(s -1) /(( s +1) *( s +2) ) ]) .1 Example 11.

1 6 ( a ) i n Openhiem &W i l l k s y p a g e 846 4 z = %z .Figure 11.2: Results of Exa 11. 3 : Root l o c u s A n a l y s i s o f L i n e a r Feedback Systems 2 // // D i s c r e t e t i m e s y s t e m 3 // R e f e r f i g u r e 1 1 .3 Root locus Analysis of Linear Feedback Systems Discrete time system // Example11 .2 Example 11. 1 183 .

5 : N y q u i s t c r i t e r i o n f o r C o n t i n u o u s Time Systems 2 // Bode P l o t 3 s = %s . 1 184 .[ z /(( z -0. 7 evans (G .2) Figure 11.3: Results of Exa 11.5Bode Nyquist criterion for Continuous Time Systems Bode Plot // Example 1 1 .5 G = syslin ( ’ d ’ .3 Example 11.5) *( z -0. 6 clf .25) ) ]) .

0.4: Results of Exa 11.4 5 6 7 8 9 10 // Open Loop T r a n s f e r F u n c t i o n G = syslin ( ’ c ’ . clf .5* s +1) ]) .100) show_margins ( F ) Figure 11.[1/( s +1) ]) .5Bode Example 11.5Nyquist Nyquist criterion for Continuous Time Systems Nyquist Plot 185 . F = G*H. bode (F .01 .[1/(0. H = syslin ( ’ c ’ .

F = G*H. 5 : N y q u i s t c r i t e r i o n f o r C o n t i n u o u s Time Systems // N y q u i s t P l o t s = %s .5Nyquist 186 .[1/(0.5* s +1) ]) . // Open Loop T r a n s f e r F u n c t i o n G = syslin ( ’ c ’ . ’ n y q u i s t ’ ) Figure 11. nyquist ( F ) show_margins (F .5: Results of Exa 11.[1/( s +1) ]) . H = syslin ( ’ c ’ . clf .1 2 3 4 5 6 7 8 9 10 // Example 1 1 .

[( s +1) /(( s -1) *(0.Example 11. // Open Loop T r a n s f e r F u n c t i o n F = syslin ( ’ c ’ . ’ n y q u i s t ’ ) Figure 11.6 187 .6 Nyquist criterion for Continuous Time Systems Nyquist Plot 1 2 3 4 5 6 7 8 // Example 1 1 . nyquist ( F ) show_margins (F .6: Results of Exa 11.5* s +1) ) ]) clf . 6 : N y q u i s t c r i t e r i o n f o r C o n t i n u o u s Time Systems // N y q u i s t P l o t s = %s .

’ n y q u i s t ’ ) Example 11.Example 11. nyquist ( F ) show_margins (F .5) ) ]) clf . clf .8 Nyquist criterion for Discrete Time Systems Nyquist Plot Discrete Time System 1 2 3 4 5 6 7 8 9 // Example 1 1 . // Open Loop T r a n s f e r F u n c t i o n G = syslin ( ’ c ’ . // Open Loop T r a n s f e r F u n c t i o n F = syslin ( ’ d ’ . T =1. 8 : N y q u i s t c r i t e r i o n f o r D i s c r e t e Time Systems // N y q u i s t P l o t // D i s c r e t e Time System z = %z . nyquist ( G ) show_margins (G . ’ n y q u i s t ’ ) 188 .s * T ) ]) .%e ^( .[ .[1/( z *( z +0.7 Nyquist Plot 1 2 3 4 5 6 7 8 9 // Example 1 1 . 7 // N y q u i s t P l o t s = %s .

[(4*(1+0.7: Results of Exa 11.5* s ) ) /( s *(1+2* s ) *(1+0.125* s ) ^2) ) ]) 6 B = syslin ( ’ c ’ . 9 : Gain and Phase M a r g i n s and t h e i r 2 // a s s o c i a t e d c r o s s o v e r f r e q u e n c i e s 3 s = poly (0 . // D e f i n e s s a s p o l y n o m i a l v a r i a b l e 4 // C r e a t e s t r a n s f e r f u n c t i o n i n f o r w a r d p a t h 5 F = syslin ( ’ c ’ .8 Example 11.05* s +(0. ’ s ’ ) .9 Gain and Phase Margins and their associated cross over frequencies 1 // Example 1 1 .(1+0* s ) /(1+0* s ) ) 7 OL = F * B . 8 fmin = 0. // Min f r e q i n Hz 189 .Figure 11.01.

// Max f r e q i n Hz 10 scf (1) . [ gm . 11 // c l f . fr2 ] = p_margin ( OL ) disp ( gm .01 . 12 // P l o t f r e q u e n c y r e s p o n s e o f open l o o p 13 14 15 16 17 18 19 20 21 transfer function bode ( OL . // d i s p l a y g a i n and p h a s e m a r g i n and c r o s s o v e r frequencies show_margins ( OL ) . ’ g a i n c r o s s o v e r f r e q u e n c y i n Hz ’ ) disp ( phm .9 fmax = 10. ’ g a i n m a r g i n i n dB ’ ) disp ( fr1 . fr1 ] = g_margin ( OL ) [ phm .0. ’ p h a s e c r o s s o v e r f r e q u e n c y i n Hz ’ ) 190 . ’ p h a s e m a r g i n i n dB ’ ) disp ( fr2 .10) .

beta_b1 = 1. clf .Figure 11. F2 = G2 * H . F1 = G1 * H .[2* beta_b1 / s ]) .9 2 3 4 5 6 7 8 9 10 Example 11.[2* beta_b2 / s ]) .9 // F i g u r e 1 1 . H = syslin ( ’ c ’ . G1 = syslin ( ’ c ’ .8: Results of Exa 11. 191 .[ s /( s -2) ]) . 9 : Root l o c u s a n a l y s i s o f 1 Linear feedback systems s = %s . beta_b2 = -1. G2 = syslin ( ’ c ’ .

9: Results of Exa 11.2) figure evans ( F2 .9 192 .2) Figure 11.11 12 13 evans ( F1 .

10: Results of Exa 11.9 193 .Figure 11.

Sign up to vote on this title
UsefulNot useful