# discrete Fourier transform

8 messages
Open this post in threaded view
|

## discrete Fourier transform

 hello, for signalanalysis I would like to use discrete Fourier transform (dft). To see, how it works, I use the simple example below. Why is XfA = abs(Xf)*2/n respectively why is  XfA = abs(Xf) wrong? clear; clc; xdel; function y = f(x);     y = sin(x); endfunction; n = 200;     x=linspace(0,2*%pi,n); y=f(x); mat = [x',y']; //disp(mat); //plot2d(x , y); //xtitle('DATA','n''','y''');   Xf=dft(y,-1); XfA = abs(Xf)*2/n;   plot2d3([1:n/2]',XfA(1:n/2));
Open this post in threaded view
|

## Re: discrete Fourier transform

 Le 21/03/2013 16:41, haasejos a écrit : > hello, > for signalanalysis I would like to use discrete Fourier transform (dft). To > see, how it works, I use the simple example below. Why is *XfA = > abs(Xf)*2/n* respectively why is  XfA = abs(Xf) wrong? Why do you say that  XfA = abs(Xf) is wrong Note however. It is much more efficient using fft instead of dft. Serge Steer > > clear; clc; xdel; > > function y = f(x); >      y = sin(x); > endfunction; > n = 200; > x=linspace(0,2*%pi,n); > y=f(x); > > mat = [x',y']; > //disp(mat); > //plot2d(x , y); > > //xtitle('DATA','n''','y'''); > > Xf=dft(y,-1); > XfA = abs(Xf)*2/n; > plot2d3([1:n/2]',XfA(1:n/2)); > > > > > -- > View this message in context: http://mailinglists.scilab.org/discrete-Fourier-transform-tp4026318.html> Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com. > _______________________________________________ > users mailing list > [hidden email] > http://lists.scilab.org/mailman/listinfo/users> _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users
Open this post in threaded view
|

## Re: discrete Fourier transform

 On 2013-03-21 17:13, Serge Steer wrote: -------------------- > Le 21/03/2013 16:41, haasejos a écrit : >> hello, >> for signalanalysis I would like to use discrete Fourier transform >> (dft). To >> see, how it works, I use the simple example below. Why is *XfA = >> abs(Xf)*2/n* respectively why is  XfA = abs(Xf) wrong? > Why do you say that  XfA = abs(Xf) is wrong > Note however. It is much more efficient using fft instead of dft. > > Serge Steer Maybe haasejos meant and should have used XfA == abs(Xf) Stefan >> >> clear; clc; xdel; >> >> function y = f(x); >>      y = sin(x); >> endfunction; >> n = 200; >> x=linspace(0,2*%pi,n); >> y=f(x); >> >> mat = [x',y']; >> //disp(mat); >> //plot2d(x , y); >> >> //xtitle('DATA','n''','y'''); >> >> Xf=dft(y,-1); >> XfA = abs(Xf)*2/n; >> plot2d3([1:n/2]',XfA(1:n/2)); >> >> >> >> >> -- >> View this message in context: >> http://mailinglists.scilab.org/discrete-Fourier-transform-tp4026318.html>> >> Sent from the Scilab users - Mailing Lists Archives mailing list >> archive at Nabble.com. >> _______________________________________________ >> users mailing list >> [hidden email] >> http://lists.scilab.org/mailman/listinfo/users>> > > _______________________________________________ > users mailing list > [hidden email] > http://lists.scilab.org/mailman/listinfo/users> _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users
Open this post in threaded view
|

## Re: discrete Fourier transform

 good evening, what I meant is, that XfA(2) should be "1". Because this value can be understood as the amplitude of sin(x). But  XfA(2) beeing calculated with XfA=abs(Xf) (see example) returns "100". This is wrong, isn't it? Josef
Open this post in threaded view
|

## Re: discrete Fourier transform

 On 2013-03-21 20:34, haasejos wrote: -------------------- > good evening, > what I meant is, that XfA(2) should be "1". Because this value can be > understood as the amplitude of sin(x). But  XfA(2) beeing calculated with > XfA=abs(Xf) (see example) returns "100". This is wrong, isn't it? > Josef > -->n = 200; -->x=linspace(0,2*%pi,n); -->y=sin(x); -->Xf=dft(y,-1); -->XfA = abs(Xf)*2/n; -->XfA(2)   ans  =      0.9974519 /Stefan _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users
Open this post in threaded view
|

## Re: discrete Fourier transform

 -->n = 200;   -->x=linspace(0,2*%pi,n);   -->y=sin(x);   -->Xf=dft(y,-1);   -->XfA = abs(Xf); please look at the difference! -->XfA(2)  ans  =       99.745189