Difference between revisions of "ECE 280/Fall 2023/HW 07"
Jump to navigation
Jump to search
(Created page with "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 t...") |
|||
Line 14: | Line 14: | ||
def X(w, a, w0): | def X(w, a, w0): | ||
return 0</syntaxhighlight> | return 0</syntaxhighlight> | ||
+ | * Do not use square brackets in place of parentheses; <code>[0]+[1]</code> yields a list <code>[0, 1]</code> whereas <code>(0)+(1)</code> yields 1. |
Revision as of 04:38, 3 November 2023
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.