P. 1
Solving Applied Mathematical Problems With MATLAB

Solving Applied Mathematical Problems With MATLAB

|Views: 11,981|Likes:
Published by sourav

More info:

Published by: sourav on Feb 24, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

07/15/2013

pdf

text

original

Computation via Gr¨unwald-Letnikov definitions

The most straightforward way in evaluating the fractional-order derivatives

numerically is to use the Gr¨unwald-Letnikov definition which is given again

aDα

t f(t) = lim
h→0

1

[(t−a)/h]
j=0

(−1)j

α
j

f(t−jh)≈ 1

[(t−a)/h]
j=0

w(α)

j f(t−jh)

(10.31)

where the binomial coefficientsw(α)

j = (−1)j

α
j

can be evaluated recursively

from

w(α)

0 = 1, w(α)

j =

1− α + 1
j

w(α)

j−1, j = 1,2,··· .

(10.32)

Nontraditional Solution Methods

401

If the step-size h is small enough, (10.31) can be used directly to calculate

approximately the values of the fractional-order derivatives, with an accuracy

of o(h)[60]

. The following MATLAB function can be written, with the syntax

y1=glfdiff(y,t,γ), where y,t describe the original function using evenly

distributed samples. The returned vector y1 is the γth order derivative.

1 function dy=glfdiff(y,t,gam)

2 h=t(2)-t(1); dy(1)=0; y=y(:); t=t(:);

3 w=1; for j=2:length(t), w(j)=w(j-1)*(1-(gam+1)/(j-1)); end

4 for i=2:length(t), dy(i)=w(1:i)*[y(i:-1:1)]/h^gam; end

Example 10.37 For function f(t) = e−t

sin(3t+1), t(0,π), study the behaviors

of the fractional-order derivatives.

Solution Select the step-sizes, T = 0.01 and 0.001, the 0.5th order derivative can

be evaluated as shown in Figure 10.42 (a). It can be seen that, when t is close to 0,

there are some differences. For larger t, the two solutions are very close. Normally

speaking, selecting T = 0.01 may give accurate results.

>> t=0:0.001:pi; y=exp(-t).*sin(3*t+1); dy=glfdiff(y,t,0.5); plot(t,dy);

t=0:0.01:pi; y=exp(-t).*sin(3*t+1); dy=glfdiff(y,t,0.5); line(t,dy)

For different selections of γ, the 3D surface representation of the fractional-order

derivative can be obtained as shown in Figure 10.42 (b).

>> Z=[]; t=0:0.01:pi; y=exp(-t).*sin(3*t+1);

for gam=0:0.1:1, Z=[Z; glfdiff(y,t,gam)]; end

surf(t,0:0.1:1,Z); axis([0,pi,0,1,-1.2,6])

0 0.5 1 1.5 2 2.5 3 3.5

−2

0

2

4

6

8

10

12

14

(a) comparisons under different step-sizes

0

1

2

3

0

0.5

1

0

2

4

6

γ

t

(b) fractional-order derivative surface

FIGURE 10.42: Fractional-order differentiation of the function

Example 10.38 Consider a sinusoidal function f(t) = sin(3t + 1). Find its

0.75th order derivative with Gr¨unwald-Letnikov definition and Cauchy’s formula,

and compare the results.

Solution According to Cauchy’s formula and (10.18), the 0.75th order derivative

can be obtained as 0D0.75

t f(t) = 30.75

sin(3t+ 1 + 0.75π/2). With the Gr¨unwald-

Letnikov definition, the derivative can be evaluated with glfdiff() function. The

two derivative curves are compared in Figure 10.43 (a).

402

Solving Applied Mathematical Problems with MATLAB

0 0.5 1 1.5 2 2.5 3 3.5

−4

−2

0

2

4

6

8

Gr¨unwald-Letnikov definition

C
a
u
c
h
y
’s

(a) comparisons of different definitions

0

1

2

3

4

0

0.5

1

−4

−2

0

2

4

γ

t

(b) 3D surface by Cauchy’s formula

FIGURE 10.43: Comparisons and 3D surfaces

>> t=0:0.01:pi; y=sin(3*t+1); y1=3^0.75*sin(3*t+1+0.75*pi/2);

y2=glfdiff(y,t,0.75); plot(t,y1,t,y2,’--’)

It can be seen that when t is small, there exists significant difference between the

two definitions. This is because, in these two definitions, the assumptions of the

function at t < 0 are considered differently. In Cauchy’s formula, it is assumed that

the function can also be described by f(t) = sin(3t + 1) when t < 0, however, for

Gr¨unwald-Letnikov definition, it is assumed that f(t) = 0 for t < 0. Thus in the

later case, there is a jump at t = 0, which causes the difference.

Again, the 3D surface can also be found for different orders γ, with the following

statements, as shown in Figure 10.43 (b). It can be seen that the fractional-order

derivatives provide information between the original function and its first-order

derivative.

>> gam=[0:0.1:1]; Y=[]; t=0:0.01:pi; y=sin(3*t+1);

for a=gam, Y=[Y; 3^a*sin(3*t+1+a*pi/2)]; end

surf(t,gam,Y)

Using filtering algorithm to compute the fractional-order calculus

In the fractional-order derivative evaluation method discussed above, the
function f(t) or its samples are known. In many other applications, the signal

f(t) is generated dynamically. In this case, a filter can be designed to evaluate

fractional-order derivative of f(t) in real-time.

For the fractional-order derivative, its Laplace representation is sγ

, which

exhibits straight lines in both Bode magnitude and phase plots. Thus it

is not possible to find a finite order filter to fit the straight lines for all
the frequencies. However, it is useful to fit the frequency responses over a

frequency range of interest.

Different continuous filters have been studied in Reference [61], among

which the Oustaloup’s filter[62]

has certain advantages. For the selected

frequency range of interest, (ωb,ωh), the continuous filter can be written as

Gf(s) = K

N

k=−N

s +ω′

k
s +ωk

(10.33)

Nontraditional Solution Methods

403

where, the poles, zeros and gain can be evaluated from

ω′

k = ωb

ωh
ωb

k+N+1

2(1−γ)

2N+1

, ωk = ωb

ωh
ωb

k+N+1

2(1+γ)

2N+1

, K = ωγ

h. (10.34)

Based on the above algorithm, the following function can be written

1 function G=ousta_fod(r,N,wb,wh)

2 mu=wh/wb; k=-N:N; w_kp=(mu).^((k+N+0.5-0.5*r)/(2*N+1))*wb;

3 w_k=(mu).^((k+N+0.5+0.5*r)/(2*N+1))*wb;

4 K=wh^r; G=tf(zpk(-w_kp’,-w_k’,K));

The continuous filter can be designed as G=ousta fod(γ,N,ωb,ωh), where

γ is the order of derivative, and 2N + 1 is the order of the filter.

Example 10.39 Select the frequency range of interest as ωb = 0.01,ωh =

100 rad/sec, and design the continuous-time approximate fractional-order filters.

For the function f(t) = e−t

sin(3t + 1), calculate the 0.5th order derivative and

verify the obtained results.

Solution The 5th order and 7th order filters can be designed

>> G1=ousta_fod(0.5,2,0.01,100),

G2=ousta_fod(0.5,3,0.01,100), bode(G1,G2),

such that

G1(s) = 10s5

+ 298.5s4

+ 1218s3

+ 768.5s2

+ 74.97s + 1

s5

+ 74.97s4

+ 768.5s3

+ 1218s2

+ 298.5s + 10 ;

G2(s) = 10s7

+509.4s6

+5487s5

+14988s4

+10786.7×104

s3

+2045s2

+98.34s+1

s7

+98.34s6

+2045s5

+1.079×104

s4

+1.499×104

s3

+5487s2

+509.4s+10.

The Bode diagrams of the above approximate filter are shown in Figure 10.44 (a),

superimposed by the theoretical straight lines. The filter output is shown in Fig-

ure 10.44 (b). Moreover, the 0.5th order derivative obtained through Gr¨unwald-

Letnikov definition can be obtained using the following MATLAB scripts and the

obtained derivative curve is also shown in Figure 10.44 (b). Clearly, the filter output

of this example is fairly accurate.

>> t=0:0.001:pi; y=exp(-t).*sin(3*t+1);

y1=lsim(G1,y,t); y2=lsim(G2,y,t); y0=glfdiff(y,t,0.5);

plot(t,y1,t,y2,t,y0)

Of course, if one is not satisfied with the filters, the frequency range of interest

and the order of the filter can both be increased.

A modified Oustaloup filter

In practical applications, it is frequently found that the filter from using
the ousta fod() function cannot exactly fit the whole expected frequency

range of interest. A new improved filter for a fractional-order derivative in

404

Solving Applied Mathematical Problems with MATLAB

−30

−20

−10

0

10

20

30

M

agnitude (dB)

10−3

10−2

10−1

100

101

102

103

0

30

60

Phase (deg)

Bode Diagram

Frequency (rad/sec)

(a) different order of filters

0 0.5 1 1.5 2 2.5 3 3.5

−1

−0.5

0

0.5

1

1.5

2

(b) derivative curves

FIGURE 10.44: Comparisons of approximate fractional-order filters

the frequency range of interest [ωb,ωh], which is shown to perform better, is

introduced in this subsection. The modified filter is[63]

dωh
b

γ

ds2

+bωhs

d(1−γ)s2

+bωhs +dγ

N

k=−N

s+ω′

k
s+ωk

(10.35)

where

ω′

k = ωb

ωh
ωb

k+N+1

2(1−γ)

2N+1

, ωk = ωb

ωh
ωb

k+N+1

2(1+γ)

2N+1

. (10.36)

Through a number of experimentation confirmation and theoretic analyses,

the modified filter achieves good approximation when b = 10 and d = 9. With
the above algorithm, a MATLAB function new fod() is written

1 function G=new_fod(r,N,wb,wh,b,d)

2 if nargin==4, b=10; d=9; end

3 mu=wh/wb; k=-N:N; w_kp=(mu).^((k+N+0.5-0.5*r)/(2*N+1))*wb;

4 w_k=(mu).^((k+N+0.5+0.5*r)/(2*N+1))*wb; K=(d*wh/b)^r;

5 G=zpk(-w_kp’,-w_k’,K)*tf([d,b*wh,0],[d*(1-r),b*wh,d*r]);

with the syntax Gf=new fod(γ,N,ωb,ωh,b,d).

Example 10.40 Consider a model G(s) =

s+ 1

10s3.2

+ 185s2.5

+ 288s0.7

+ 1, which

is a fractional-order model. Compare the two Oustaloup filters.

Solution The exact Bode diagram can be obtained with the bode() function.

The approximations to the 0.2th order derivative using the Oustaloup’s filter and

the modified Oustaloup’s filter can be obtained as shown in Figure 10.45 (a). The

frequency range of good fitting is larger with the improved filter. Also the approx-

imation to the G(s) model is shown in Figure 10.45 (b). It can be seen that the

modified method provided a much better fit.

>> b=[1 1]; a=[10,185,288,1]; nb=[1 0]; na=[3.2,2.5,0.7,0];

w=logspace(-4,4,200); G0=fotf(a,na,b,nb); H=bode(G0,w);

Nontraditional Solution Methods

405

s=zpk(’s’); N=4; w1=1e-3; w2=1e3; b=10; d=9;

g1=ousta_fod(0.2,N,w1,w2); g2=ousta_fod(0.5,N,w1,w2); a1=g1;

g3=ousta_fod(0.7,N,w1,w2); G1=(s+1)/(10*s^3*g1+185*s^2*g2+288*g3+1);

g1=new_fod(0.2,N,w1,w2,b,d); g2=new_fod(0.5,N,w1,w2,b,d);

g3=new_fod(0.7,N,w1,w2,b,d); bode(g1,a1); figure

G2=(s+1)/(10*s^3*g1+185*s^2*g2+288*g3+1); bode(H,G1,G2)

−40

−30

−20

−10

0

10

20

M

agnitude (dB)

10−4

10−2

100

102

104

0

45

90

Phase (deg)

Bode Diagram

Frequency (rad/sec)

← modified

Oustaloup’s

← modified

← Oustaloup’s

(a) s0.2

fittings

−200

−150

−100

−50

0

M

agnitude (dB)

10−4

10−2

100

102

104

−180

−135

−90

−45

0

Phase (deg)

Bode Diagram

Frequency (rad/sec)

Oustaloup’s

← Oustaloup’s

(b) Bode diagram comparisons

FIGURE 10.45: Bode diagram comparisons

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->