ECE 280/Spring 2024/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_letter or x_letter depending on whether you are finding a Fourier transform or an inverse Fourier transform, respectively. The code for 4.21(b, f) and 4.22(c, e) is already done; the handwritten work is on Canvas.

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_a(t):
        u = lambda t: (t>0)*1.0
        return 0*t
    
  • 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_a(w, a, w0):
        return 0*w
    
  • 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}$$)