ECE 280/Fall 2023/HW 07

From PrattWiki
Jump to navigation Jump to search

For some parts of Homework 7, in addition to uploading the PDF of your work, you will be coding your answer and uploading it to Gradescope. All you need to do is write code that replicates your formula - generally, this will go after the word return in a function that is either called X or x depending on whether you are finding a Fourier transform or an inverse Fourier transform, respectively. The code for 4.21(b) and 4.22(c) is already done; the handwritten work is in the Resources section on Sakai.

Notes

  • $$\pi$$ is written as np.pi
  • $$a^b$$ is written as a**b
  • cos(t) is written as np.cos(t)
  • sin(t) is written as np.sin(t)
  • $$e^{t}$$ is written as np.exp(t)
  • If you need to define a subfunction, define it in the context of your main function. For instance, in 4.22(a), your answer needs the unit step function. As a result, the example file has it within the x function:
    def x(t):
        u = lambda t: (t>0)*1.0
        return 0
    
  • If your function has multiple symbolic parameters, the example file for it will have that as well. For instance, in 4.21(a), your answer will have the exponent $$a$$ and sinusoidal frequency $$\omega_0$$; the example function is:
    def X(w, a, w0):
        return 0
    
  • Do not use square brackets in place of parentheses; [0]+[1] yields a list [0, 1] whereas (0)+(1) yields 1.
  • $$\frac{1}{j\omega}$$ needs to be coded as 1/(1j*w) or 1/1j/w, not 1/1j*w (that would be $$\frac{w}{j}$$)