Question: Fourier serie and Discrete Fourier Transform

Hi,

I have the function:

restart: with(plots): with(OrthogonalExpansions): with(DiscreteTransforms):

f:=t->piecewise(t<0,0,t<1,t,t<2,2-t,0);

The Fourier coefficients a[0], a[i] and b[i] can be calculated by:

T:=2: Trig:=FourierSeries(f(t),t=0..T,n,'Coefficients');

a[0]:= op(1, Coefficients);a[i]:= op(1, op(2, Coefficients))[1];b[i]:= op(1, op(2, Coefficients))[2];

I want to calculate those coefficients a[0], a[i] and b[i] using Discrete Fourier Transform ?

I think the command for the calculation is:

N:=20: dt:=T/N: Z := FourierTransform(<seq(evalf(f(i*dt)),i=0..N-1)>,N);

How to get a[0], a[i] and b[i] ?

Thanks

Kamel

Please Wait...