Rowan-Classes/8th-Semester-Spring-2025/clinic-consultant/labs/lab-1/lab1q6.py

30 lines
897 B
Python

"""
ECE 09351 - Digital Signal Processing
Lab 1 Question 6
Translated from MATLAB by Aidan Sharpe
Last Modified: January 18, 2025
"""
from sympy import *
from sympy.abc import a, b, t, w
# Please note that the answers are given as piecewise functions.
# The conditions are unnecessary, so take the first part of the piecewise result.
def main():
# Assume that a and b are positive real numbers
with assuming(Q.positive(a), Q.positive(b)):
x_1 = exp(-a*abs(t)) # x1(t) = e^(-a|t|)
X_1 = integrate(x_1*exp(-1j*w*t), (t, -oo, oo)) # Fourier transform of x1(t)
print(simplify(X_1))
x_2 = x_1*cos(b*t) # x2(t) = x1(t)*cos(bt)
X_2 = integrate(x_2*exp(-1j*w*t), (t, -oo, oo)) # Fourier transform of x2(t)
print(simplify(X_2))
if __name__ == "__main__":
main()