Last active
January 1, 2021 20:13
-
-
Save Barry1/4640240945b7e4883712490cb71b0f94 to your computer and use it in GitHub Desktop.
SymPy-Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
#from __future__ import division | |
import sympy | |
sympy.init_printing(use_unicode=False) | |
t = sympy.symbols('t', real=True) | |
omega = sympy.symbols('\\omega', positive=True) | |
f1 = 281/10 | |
f2 = 3*f1 | |
omega1 = 2*sympy.pi*f1 | |
omega2 = 2*sympy.pi*f2 | |
testsignal = sympy.sin(omega1*t)+.7*sympy.cos(omega2*t) | |
Tges = 10 | |
foursig = sympy.integrate(testsignal*sympy.cos(omega*t), (t, 0, Tges))/Tges - \ | |
sympy.I*sympy.integrate(testsignal*sympy.sin(omega*t), (t, 0, Tges))/Tges | |
sympy.pprint(foursig) | |
res = sympy.integrate(abs(foursig), (omega, 2*sympy.pi*27.5, 2*sympy.pi*28.5)) | |
sympy.pprint(res) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment