List Archives > 
Maple User Group List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[MUG] Re: Fourier series
| [MUG] Re: Fourier series |
|
Author: Maple Group
Posted: 29/11/2000 14:23:03 GMT
|
>> From: Maple Group "maple_gr"
>> From: Chuck Baker "geogra4"
| I have developed a Fourier series of the following function with a period
| of 2pie.
|
| 0, -pie < x < -pie/2
| f(x) = 1, -pie/2 < x < pie/2
| 0, pie/2 < x < pie
|
| I derived the following answer by hand:
| F(x) = 1/2 + 2/pie(cos x - 1/3 cos3x + 1/5 cos5x +....)
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Sun, 26 Nov 2000 17:39:20 +0100
From: Backes "backes"
To: "maple-list"
Subject: Fourier series
The following scheme works nicely for all piecewhise defined functions:
> ch:= (a,b)->Heaviside(t-a)*Heaviside(-t+b):
> T:=2*Pi; omega:=2*Pi/T; N:=5;
T := 2 Pi
omega := 1
N := 5
> f:=ch(-Pi/2,Pi/2);
f := Heaviside(t + 1/2 Pi) Heaviside(-t + 1/2 Pi)
> a:=array(0..0); b:=array(1..N);
a := array(0 .. 5, [])
b := array(1 .. 5, [])
> a[0]:=evalf(2/T*int(f, t=0..T));
> for i from 1 to N do
> b[i]:=eval(2/T*int(f*sin(i*omega*t), t=0..T) );
> od;
a[0] := .5000000000
1
b[1] := ----
Pi
1
b[2] := ----
Pi
1
b[3] := 1/3 ----
Pi
b[4] := 0
1
b[5] := 1/5 ----
Pi
Greetings from merry old Europe.
Backes
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Wed, 29 Nov 2000 13:24:19 +0100
From: Barsuhn "barsuhn"
Subject: Fourier series
To: "maple-list"
Dear Chuck,
use the following piece of Maple code
> restart;
> f:=x->piecewise(x<-Pi/2,0,x<Pi/2,1,0);# define the function
> f(x);# inspect the function f
> plot(f,-Pi..Pi,-1..2,axes=boxed,scaling=constrained);# get the plot of f
> a:=1/Pi*int(f(x)*cos(n*x),x=-Pi..Pi);a:=unapply(a,n);
> b:=2/Pi*int(f(x)*sin(n*x),x=-Pi..Pi);b:=unapply(b,n);
> number:=10;#as an example
> a(0):=1/Pi*int(f(x),x=-Pi..Pi);# a0 in the remember table
> Summe:=a(0)/2+sum(a(k)*cos(k*x)+b(k)*sin(k*x),k=1..number);
>
plot([f(x),Summe],x=-Pi..Pi,-1..2,axes=boxed,scaling=constrained,color=[red,blue
]);#
get a picture of f(x) and its partial Fourier sum
>
This will work for many other functions (period 2*Pi assumed), that you
may define using piecewise. You obtain the exact Fourier coefficients.
In more complicated cases, however, you will have to replace a(0), a(k),
b(k) by evalf(a(0)) etc. in the assignment to Summe.
All the best Jurgen
--
-------------------
Prof. Dr. Jurgen Barsuhn
Fachhochschule Bielefeld
University of Applied Sciences
Fachbereich Elektrotechnik und Informationstechnik
Wilhelm-Bertelsmann-Str. 10
D-33602 Bielefeld
-----------
|
[View Complete Thread]
Previous by date: [MUG] Re: neutral operator, Ira Gessel
Next by date: [MUG] Re: Integration bug, i think, Maple Group
Previous thread: [MUG] How to processing date-lists, Norbert Roth
Next thread: [MUG] Integration bug, i think, Halvor Mehlum
|