Question
from sympy import symbols,Function,pprint,Wild,Derivative,Integral from sympy import laplace_transform, LaplaceTransform,factor_list from sympy import inverse_laplace_transform,solve s = symbols('s',complex=True) t = symbols('t', real=True) class skel(): def __init__(self,arg): print('make
from sympy import symbols,Function,pprint,Wild,Derivative,Integral from sympy import laplace_transform, LaplaceTransform,factor_list from sympy import inverse_laplace_transform,solve
s = symbols('s',complex=True) t = symbols('t', real=True) class skel(): def __init__(self,arg): print('make some symbols',arg) self.x=symbols(arg) print(self.x) def skel_fcn(self,arg): print('execute some code',arg,self.x) def laplace(e,t,s): res=laplace_transform(e,t,s,noconds=True) wf=Wild('f') lw=LaplaceTransform(wf,t,s) for exp in res.find(lw): e=exp.match(lw)[wf] args = e.args if isinstance(e,Derivative): if len(args) == 2 and args[1][0]==t: n=args[1][1] if n > 0: newexp = s**n*LaplaceTransform(e.args[0],t,s) res=res.replace(exp,newexp) return(res)
def get_polynomial(L): #set() is the empty set z=factor_list(L) ## pprint(z) wf = Wild('f') lw=LaplaceTransform(wf,t,s) factor=z[0] ## pprint(z[1]) for f in z[1]: if f[0].find(lw) == set(): factor=factor*(f[0]**f[1]) return (factor)
def main(): global s,t y = Function('y')(t) Y = laplace(y.diff(t,1)-3*y.diff(t,2)*y,t,s) Y1=get_polynomial(Y) # pprint(Y1) u = Function('u')(t) U = laplace(u.diff(t,1)+u,t,s) U1=get_polynomial(U) # pprint(U1) G = U1/Y1 pprint(G) pprint(G.apart()) pprint(solve(Y1))
if __name__ == "__main__": main()
Use this code to find the transfer function of :
+ 3 y = u
- 3 y = u
+4+4y=u
-4+4y=u-2u
y++6+24y=u
SHOW THE MODIFIED CODE
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started