Unit Step Function

800 days 전, namy0727 작성

#6.3 Unit Step Function Example #a = 2 var('t, s') u2(t) = unit_step(t-2) show(u2(t)) plot(u2(t),(t,0,4)) 
       

#6.3 Unit Step Function Laplace Transform U2(s) = u2.laplace('t','s') print "L[u(t - 2)] ="; show(U2(s)) 
       
L[u(t - 2)] =
L[u(t - 2)] =
#6.3 Effects of the Unit Atep Function f(t) = 5*sin(t) u2(t) = unit_step(t-2) show(f(t)) show(f(t)*u2(t)) plot(f(t),(t,0,2*pi), color='red') + plot(f(t)*u2(t), (t,0,2*pi)) 
       


#6.3 Effects of the Unit Atep Function Cont'd show(f(t)) show(f(t-2)*u2(t)) plot(f(t),(t,0,2*pi), color='red') + plot(f(t-2)*u2(t), (t,0,2*pi)) 
       


#6.3 Use of Many Unit Step Functions print "(A), k = 1" var('t') k = 1 f(t) = k*(unit_step(t - 1) - 2*unit_step(t - 4) + unit_step(t - 6)) show(f(t)) plot(f(t),(t,0,8)) 
       
(A), k = 1

(A), k = 1

#6.3 Use of Many Unit Step Functions Cont'd print "(B)" f(t) = 4*sin((1/2)*pi*t)*(unit_step(t) - unit_step(t - 2) + unit_step(t - 4) - unit_step(t - 6) + unit_step(t - 8) - unit_step(t - 10)) show(f(t)) plot(f(t),(t,0,12)) 
       
(B)

(B)

#6.3 Example 1 var('t, s') f(t) = 2*(1 - unit_step(t - 1)) + (1/2)*(t^2)*(unit_step(t - 1) - unit_step(t - (1/2)*pi)) + cos(t)*unit_step(t - (1/2)*pi) show(f(t)) plot(f(t),(t,0,4*pi)) 
       

#6.3 Example 1 Cont'd f1(t) = 2*(1 - unit_step(t - 1)) print "f1(t) ="; show(f1(t)) F1(s) = f1.laplace('t','s') print "F1(s) ="; show(F1(s)) f2(t) = (1/2)*t^2*unit_step(t - 1) print "f2(t) ="; show(f2(t)) F2(s) = f2.laplace('t','s') print "F2(s) ="; show(F2(s)) f3(t) = (1/2)*t^2*unit_step(t - (1/2)*pi) print "f3(t) ="; show(f3(t)) F3(s) = f3.laplace('t','s') print "F3(s) ="; show(F3(s)) f4(t) = cos(t)*unit_step(t - (1/2)*pi) print "f4(t) ="; show(f4(t)) F4(s) = f4.laplace('t','s') print "F4(s) ="; show(F4(s)) 
       
f1(t) =

F1(s) =

f2(t) =

F2(s) =

f3(t) =

F3(s) =

f4(t) =

F4(s) =
f1(t) =

F1(s) =

f2(t) =

F2(s) =

f3(t) =

F3(s) =

f4(t) =

F4(s) =
#6.3 Example 1 Cont'd F(s) = F1(s) + F2(s) - F3(s) + F4(s) print "F(s) = F1(s) + F2(s) - F3(s) + F4(s) =" show(F(s)) 
       
F(s) =  F1(s) + F2(s) - F3(s) + F4(s) =
F(s) =  F1(s) + F2(s) - F3(s) + F4(s) =
#6.3 Time-Shifting Function def timeshift(func,a): return func.subs(t = t - a)*unit_step(t - a) 
       
#6.3 Example 2 var('t, s') F(s)= exp(-s)/(s^2 + pi^2) + exp(-2*s)/(s^2 + pi^2) + exp(-3*s)/(s + 2)^2 print "F(s) ="; show(F(s)) 
       
F(s) =
F(s) =
#6.3 Example 2 Cont'd G1(s) = 1/(s^2 + pi^2) print "G1(s) ="; show(G1(s)) g1(t) = inverse_laplace(G1,s,t) print "g1(t) ="; show(g1(t)) f1(t) = timeshift(g1,1) print "f1(t) ="; show(f1(t)) f2(t) = timeshift(g1,2) print "f2(t) ="; show(f2(t)) 
       
G1(s) =

g1(t) =

f1(t) =

f2(t) =
G1(s) =

g1(t) =

f1(t) =

f2(t) =
#6.3 Example 2 Cont'd G2(s) = 1/(s + 2)^2 print "G2(s) ="; show(G2(s)) g2(t) = inverse_laplace(G2,s,t) print "g2(t) ="; show(g2(t)) f3(t) = timeshift(g2,3) print "f3(t) ="; show(f3(t)) 
       
G2(s) =

g2(t) =

f3(t) =
G2(s) =

g2(t) =

f3(t) =
#6.3 Example 2 Cont'd f(t) = f1(t) + f2(t) + f3(t) print "f(t) = f1(t) + f2(t) + f3(t) =" show(f(t)) f(t) = (f1(t) + f2(t)).simplify_trig() + f3(t) print "f(t) ="; show(f(t)) plot(f(t),(t,0,6)) 
       
f(t) = f1(t) + f2(t) + f3(t) =

f(t) =

f(t) = f1(t) + f2(t) + f3(t) =

f(t) =

#6.3 Example 4 #i(0) = 0, di(0)/dt = 0 t, s, i, u = var('t, s, i, u') i(t) = function('i')(t) de = 0.1*diff(i(t),t) + 11*i(t) + 100*integral(i(u),u,0,t) == 100*sin(400*t)*(1 - unit_step(t - 2*pi)) de_symb = maxima(de) laplace_eq = de_symb.laplace('t','s'); show(laplace_eq) 
       
#6.3 Example 4 Cont'd I = var('I') laplace_eq = [0.1*s*I + 100*I/s + 11*I == 100*exp(-2*pi*s)*(400*exp(2*pi*s) - 400)/(s^2 + 160000)] laplace_sol = solve(laplace_eq,I) show(laplace_sol) 
       
#6.3 Example 4 Cont'd I1 = 400000*s/(s^4 + 110*s^3 + 161000*s^2 + 17600000*s + 160000000) I1 = I1.partial_fraction() print "I1(s) ="; show(I1) i1 =inverse_laplace(I1,s,t) print "i1(t) ="; show(i1) 
       
I1(s) =

i1(t) =
I1(s) =

i1(t) =
#6.3 Example 4 Cont'd i2(t) = timeshift(i1,2*pi) print "i2(t) ="; show(i2(t)) 
       
i2(t) =
i2(t) =
#6.3 Example 4 Cont'd i2(t) = -400/244953*(1431*cos(400*t) - 1601*exp(200*pi - 100*t) + 170*exp(20*pi - 10*t) - 396*sin(400*t))*unit_step(-2*pi + t) i(t) = i1(t) - i2(t) print "i(t) = i1(t) - i2(t) ="; show(i(t)) 
       
__main__:1: DeprecationWarning: Substitution using function-call syntax
and unnamed arguments is deprecated and will be removed from a future
release of Sage; you can use named arguments instead, like EXPR(x=...,
y=...)
See http://trac.sagemath.org/5930 for details.
i(t) = i1(t) - i2(t) =
__main__:1: DeprecationWarning: Substitution using function-call syntax and unnamed arguments is deprecated and will be removed from a future release of Sage; you can use named arguments instead, like EXPR(x=..., y=...)
See http://trac.sagemath.org/5930 for details.
i(t) = i1(t) - i2(t) =