Page 121 -
P. 121
dt=(tfin-tin)/(N-1);
u=sin(t);
a=(1/(2*pi))*ones(1,N);
b=ones(1,N);
y(1)=0;
D(1)=(1/a(1))*(u(1)-b(1)*y(1));
for k=2:N
y(k)=((2*a(k)/dt+b(k))^(-1))*...
(2*a(k)*y(k-1)/dt+a(k)D(k-1)+u(k));
D(k)=(2/dt)*(y(k)-y(k-1))-D(k-1);
end
plot(t,y,t,u,'--')
In-Class Exercise
Pb. 4.37 Plot the amplitude of y, and its dephasing from u, as a function of
a for large t.
Example 4.9
Find the first-order iterative scheme to solve the second-order differential
equation given by:
2
dy dy
at() 2 + bt() + ct y() = u t() (4.34)
dt dt
dy
with initial conditions yt( = 0 ) and given.
dt t=0
Solution: Substituting the above first-order expression of the iterators for the
first-order and second-order numerical differentiators [respectively Eqs.
(4.16) and (4.30), into Eq. (4.34)], we deduce the following iterative equation
for y(k):
ak () bk () −1
yk () = 4 + 2 + ck () ×
(∆ t) 2 t ∆
(4.35)
ak () bk () ak ()
yk ( − 14 2 + 2 + Dk ( − 1 4 + bk() + a k D k() 2 ( − 1 ) + u k()
)
)
(∆ t) ∆ t t ∆
© 2001 by CRC Press LLC