integral transforms - scilab · outline calculus/laplace transform using symbolic toolbox fourier...

34
Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms Integral Transforms Deepak U. Patil and Madhu N Belur [email protected] [email protected] Dept. of Electrical Engineering Indian Institute of Technology, Bombay Funded by National Mission on Education through ICT December 23, 2009 Integral Transforms

Upload: vandat

Post on 09-Jun-2019

260 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Integral Transforms

Deepak U. Patil and Madhu N [email protected]@ee.iitb.ac.in

Dept. of Electrical EngineeringIndian Institute of Technology, Bombay

Funded by National Mission on Education through ICT

December 23, 2009

Integral Transforms

Page 2: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Calculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Integral Transforms

Page 3: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

System Administration Tasks

I Interface between Maxima and Scilab.

I Enter directory where toolbox is kept. You will see twodirectories.

I Execute builder.sce and loader.sce (from both OVLD andSYM directories).

I In our case Just type exec(’symbolic.sce’).

I restartserver and killserver

I Create Symbolic Objects ’a’ and ’b’ using syms a b.

I Symbolic Operations can be done with these objects.

Integral Transforms

Page 4: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

System Administration Tasks

I Interface between Maxima and Scilab.

I Enter directory where toolbox is kept. You will see twodirectories.

I Execute builder.sce and loader.sce (from both OVLD andSYM directories).

I In our case Just type exec(’symbolic.sce’).

I restartserver and killserver

I Create Symbolic Objects ’a’ and ’b’ using syms a b.

I Symbolic Operations can be done with these objects.

Integral Transforms

Page 5: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

System Administration Tasks

I Interface between Maxima and Scilab.

I Enter directory where toolbox is kept. You will see twodirectories.

I Execute builder.sce and loader.sce (from both OVLD andSYM directories).

I In our case Just type exec(’symbolic.sce’).

I restartserver and killserver

I Create Symbolic Objects ’a’ and ’b’ using syms a b.

I Symbolic Operations can be done with these objects.

Integral Transforms

Page 6: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

System Administration Tasks

I Interface between Maxima and Scilab.

I Enter directory where toolbox is kept. You will see twodirectories.

I Execute builder.sce and loader.sce (from both OVLD andSYM directories).

I In our case Just type exec(’symbolic.sce’).

I restartserver and killserver

I Create Symbolic Objects ’a’ and ’b’ using syms a b.

I Symbolic Operations can be done with these objects.

Integral Transforms

Page 7: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

System Administration Tasks

I Interface between Maxima and Scilab.

I Enter directory where toolbox is kept. You will see twodirectories.

I Execute builder.sce and loader.sce (from both OVLD andSYM directories).

I In our case Just type exec(’symbolic.sce’).

I restartserver and killserver

I Create Symbolic Objects ’a’ and ’b’ using syms a b.

I Symbolic Operations can be done with these objects.

Integral Transforms

Page 8: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

System Administration Tasks

I Interface between Maxima and Scilab.

I Enter directory where toolbox is kept. You will see twodirectories.

I Execute builder.sce and loader.sce (from both OVLD andSYM directories).

I In our case Just type exec(’symbolic.sce’).

I restartserver and killserver

I Create Symbolic Objects ’a’ and ’b’ using syms a b.

I Symbolic Operations can be done with these objects.

Integral Transforms

Page 9: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

System Administration Tasks

I Interface between Maxima and Scilab.

I Enter directory where toolbox is kept. You will see twodirectories.

I Execute builder.sce and loader.sce (from both OVLD andSYM directories).

I In our case Just type exec(’symbolic.sce’).

I restartserver and killserver

I Create Symbolic Objects ’a’ and ’b’ using syms a b.

I Symbolic Operations can be done with these objects.

Integral Transforms

Page 10: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Symbolic Differentiation/Integration/Limits

I diff(f,x) //differentiate function f w.r.t x.

I integ(f,x) // Indefinite Integral of f w.r.t x.

I integ(f,x,0,a)//Definite Integral of f w.r.t x from limits 0 to a(a is numericconstant).

I limit(f,x,0) //limit of f as x tends to 0.

Integral Transforms

Page 11: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Symbolic Differentiation/Integration/Limits

I diff(f,x) //differentiate function f w.r.t x.

I integ(f,x) // Indefinite Integral of f w.r.t x.

I integ(f,x,0,a)//Definite Integral of f w.r.t x from limits 0 to a(a is numericconstant).

I limit(f,x,0) //limit of f as x tends to 0.

Integral Transforms

Page 12: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Symbolic Differentiation/Integration/Limits

I diff(f,x) //differentiate function f w.r.t x.

I integ(f,x) // Indefinite Integral of f w.r.t x.

I integ(f,x,0,a)//Definite Integral of f w.r.t x from limits 0 to a(a is numericconstant).

I limit(f,x,0) //limit of f as x tends to 0.

Integral Transforms

Page 13: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Symbolic Differentiation/Integration/Limits

I diff(f,x) //differentiate function f w.r.t x.

I integ(f,x) // Indefinite Integral of f w.r.t x.

I integ(f,x,0,a)//Definite Integral of f w.r.t x from limits 0 to a(a is numericconstant).

I limit(f,x,0) //limit of f as x tends to 0.

Integral Transforms

Page 14: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Laplace Transforms

I Laplace Transform: F (s) =∞∫0

f (t)e−stdt

I Create Symbolic Objects ’s’ and ’t’.

I laplace(p) //laplace transform of function p.

I ilaplace(p)//Inverse Laplace Transform of function p.

I e.g. syms s tlaplace(t)ilaplace(1/s∧2)

Integral Transforms

Page 15: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Laplace Transforms

I Laplace Transform: F (s) =∞∫0

f (t)e−stdt

I Create Symbolic Objects ’s’ and ’t’.

I laplace(p) //laplace transform of function p.

I ilaplace(p)//Inverse Laplace Transform of function p.

I e.g. syms s tlaplace(t)ilaplace(1/s∧2)

Integral Transforms

Page 16: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Laplace Transforms

I Laplace Transform: F (s) =∞∫0

f (t)e−stdt

I Create Symbolic Objects ’s’ and ’t’.

I laplace(p) //laplace transform of function p.

I ilaplace(p)//Inverse Laplace Transform of function p.

I e.g. syms s tlaplace(t)ilaplace(1/s∧2)

Integral Transforms

Page 17: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Laplace Transforms

I Laplace Transform: F (s) =∞∫0

f (t)e−stdt

I Create Symbolic Objects ’s’ and ’t’.

I laplace(p) //laplace transform of function p.

I ilaplace(p)//Inverse Laplace Transform of function p.

I e.g. syms s tlaplace(t)ilaplace(1/s∧2)

Integral Transforms

Page 18: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Laplace Transforms

I Laplace Transform: F (s) =∞∫0

f (t)e−stdt

I Create Symbolic Objects ’s’ and ’t’.

I laplace(p) //laplace transform of function p.

I ilaplace(p)//Inverse Laplace Transform of function p.

I e.g. syms s tlaplace(t)ilaplace(1/s∧2)

Integral Transforms

Page 19: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Preliminary Version

I There are a lot of bugs.

I Command are similar to Matlab Symbolic toolbox.

I All function of its matlab counterpart are not available.

I One can always depend on help documentation.

I Reference:www.cert.fr/dcsd/idco/perso/Magni/s sym/doc/index.html

Integral Transforms

Page 20: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Preliminary Version

I There are a lot of bugs.

I Command are similar to Matlab Symbolic toolbox.

I All function of its matlab counterpart are not available.

I One can always depend on help documentation.

I Reference:www.cert.fr/dcsd/idco/perso/Magni/s sym/doc/index.html

Integral Transforms

Page 21: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Preliminary Version

I There are a lot of bugs.

I Command are similar to Matlab Symbolic toolbox.

I All function of its matlab counterpart are not available.

I One can always depend on help documentation.

I Reference:www.cert.fr/dcsd/idco/perso/Magni/s sym/doc/index.html

Integral Transforms

Page 22: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Preliminary Version

I There are a lot of bugs.

I Command are similar to Matlab Symbolic toolbox.

I All function of its matlab counterpart are not available.

I One can always depend on help documentation.

I Reference:www.cert.fr/dcsd/idco/perso/Magni/s sym/doc/index.html

Integral Transforms

Page 23: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Preliminary Version

I There are a lot of bugs.

I Command are similar to Matlab Symbolic toolbox.

I All function of its matlab counterpart are not available.

I One can always depend on help documentation.

I Reference:www.cert.fr/dcsd/idco/perso/Magni/s sym/doc/index.html

Integral Transforms

Page 24: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Fourier Transform

I The continuous Fourier Transform is defined

as:F (ω) =∞∫−∞

f (t)e−jωtdt

I We will consider Discrete Fourier Transform (DFT).

I DFT is defined as X (p) =∑N−1

n=0 f (n)e−2πpnj

N

Integral Transforms

Page 25: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Discrete Fourier Transform

For a periodic sequence: DFT (Discrete Fourier Transform) givesthe frequency content.Linear transformation on the input sequence.Take signal values of just one period: finite dimensional signal (dueto periodicity of N).

X (k) :=N−1∑n=0

x(n)e−2πik

Nn for k = 0, . . . ,N − 1 (analysis equation)

e−2πikN is the Nth root of unity.Inverse DFT for the synthesis equation. Normalization constantsvary in the literature.

Integral Transforms

Page 26: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Discrete Fourier Transform

What is the matrix defining relating the DFT X (k) of the signal

x(n)? Define ω := e−2πik

Nn.

X (0)X (1)

...X (N − 1)

=

1 1 1 · · · 11 ω ω2 · · · ωN−1

1 ω2 ω4 · · · ω2N−2

1...

.... . .

...

1 ωN−1 ω2N−2 · · · ω(N−1)2

x(0)x(1)

...x(N − 1)

(Note: ωN = 1, etc.)Check that the above N × N matrix has nonzero determinant.(Change of basis.) Moreover, columns are orthogonal.Orthonormal? (Normalization (by

√N) not done yet.)

Integral Transforms

Page 27: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Discrete Fourier Transform and interpolation

Van der monde matrix: closely related to interpolation problems

Of course, inverse DFT is nothing but interpolation! Used incomputation of determinant of a polynomial matrix.Construct p(s) := x0 + x1s + x2s

2 · · ·+ xN−1sN−1

To obtain X (k), evaluate p at s = ωk .X (k) = p(ωk) horner commandGiven values of p(ωk) for various ωk (i.e., X (k)),find the coefficients of the polynomial p(s): inverseDFT: interpolation of a polynomial to ‘fit’ givenvalues at specified (complex) numbers.

Integral Transforms

Page 28: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Discrete Fourier Transform and interpolation

Van der monde matrix: closely related to interpolation problemsOf course, inverse DFT is nothing but interpolation! Used incomputation of determinant of a polynomial matrix.Construct p(s) := x0 + x1s + x2s

2 · · ·+ xN−1sN−1

To obtain X (k), evaluate p at s = ωk .X (k) = p(ωk) horner commandGiven values of p(ωk) for various ωk (i.e., X (k)),find the coefficients of the polynomial p(s): inverseDFT: interpolation of a polynomial to ‘fit’ givenvalues at specified (complex) numbers.

Integral Transforms

Page 29: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Discrete Fourier Transform and interpolation

Van der monde matrix: closely related to interpolation problemsOf course, inverse DFT is nothing but interpolation! Used incomputation of determinant of a polynomial matrix.Construct p(s) := x0 + x1s + x2s

2 · · ·+ xN−1sN−1

To obtain X (k), evaluate p at s = ωk .X (k) = p(ωk)

horner commandGiven values of p(ωk) for various ωk (i.e., X (k)),find the coefficients of the polynomial p(s): inverseDFT: interpolation of a polynomial to ‘fit’ givenvalues at specified (complex) numbers.

Integral Transforms

Page 30: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

Discrete Fourier Transform and interpolation

Van der monde matrix: closely related to interpolation problemsOf course, inverse DFT is nothing but interpolation! Used incomputation of determinant of a polynomial matrix.Construct p(s) := x0 + x1s + x2s

2 · · ·+ xN−1sN−1

To obtain X (k), evaluate p at s = ωk .X (k) = p(ωk) horner commandGiven values of p(ωk) for various ωk (i.e., X (k)),find the coefficients of the polynomial p(s): inverseDFT: interpolation of a polynomial to ‘fit’ givenvalues at specified (complex) numbers.

Integral Transforms

Page 31: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

FFT

Since many powers of ω are repeated in that matrix (only N − 1powers are different, many real/imaginary parts are repeated foreven N), redundancy can be drastically decreased.

Length of the signal is a power of 2: recursive algorithm possible.

Integral Transforms

Page 32: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

FFT

Since many powers of ω are repeated in that matrix (only N − 1powers are different, many real/imaginary parts are repeated foreven N), redundancy can be drastically decreased.Length of the signal is a power of 2: recursive algorithm possible.

Integral Transforms

Page 33: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

FFT: recursive implementation

I Separate p(s) (coefficients x0, . . . , xN−1) into its even and oddpowers (even and odd indices k). N is divisible by 2.

I Compute DFT of podd and peven separately. (Do sameseparation, if possible.)

I Let Xodd and Xeven denote the individual DFT’s. (Same length.)

I Define D := diag(1, ω, ω2, . . . , ωN2−1)

I Combine the two separate DFT’s using the formula

X (k) = Xeven + DXodd for k = 0, . . . , N2 − 1

X (k) = Xeven − DXodd for k = N2 , . . . ,N − 1

Integral Transforms

Page 34: Integral Transforms - Scilab · Outline Calculus/Laplace Transform Using Symbolic Toolbox Fourier Transforms System Administration Tasks I Interface between Maxima and Scilab. I Enter

OutlineCalculus/Laplace Transform Using Symbolic Toolbox

Fourier Transforms

FFT using Scilab Command

I fft//Calculates the DFT of given signal using Fast FourierTransform Algorithm

I ifft //Inverse DFT can be obtained.

I e.g. Discretize f = sin t by putting t=0:N-1 into N samples.F=fft(f) //DFT of vecor ff=ifft(F) //inverse DFT of F.

Integral Transforms