Sign in

username:

password:



Not a member?

Search matlab



Search tips

Subscribe to matlab



matlab by Keywords

Atanh | Autocorrelation | Bandpass Filter | C++ | Conv | Database | Deconv | Excel | FFT | Filter | Filtering | FIR | Fourier Transfrom | FSK | Gaussian Noise | Haykin | IFFT | Image | Java | LFSR | LMS | LPC | MEX | OFDM | QPSK | Radix | Random | Sampling | Segmentation | Simulink | Visual Basic | Waveform | Wavelet

Ads

Discussion Groups

Discussion Groups | Matlab DSP | Help with FFT and IFFT

Technical discussion about Matlab and issues related to Digital Signal Processing.

  

Post a new Thread

Help with FFT and IFFT - marc...@gmail.com - Apr 13 11:20:01 2008



Hi!!

I am new to matlab so please bear with me. I don't understand the IFFT and FFT matlab
functions. Here is the code i am using:

[sig,fs]=wavread('aemixed.wav');
time=(1:length(sig))'/fs;

figure(1)
plot(time,sig)

fsig1 = fft(sig,fs);
Y=real((ifft(fsig1,length(sig))));
figure(3)
plot(time,Y)

What I don't understand is that Y and sig are not the same. Can someone please explain this to
me. And some help as to to what to do to fsig1 so that when I take the ifft, the result is the
same as sig.



(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )

Re: Help with FFT and IFFT - Jeff Brower - Apr 14 10:10:21 2008

Marciful-

> I am new to matlab so please bear with me. I don't understand the IFFT
> and FFT matlab functions. Here is the code i am using:
>
> [sig,fs]=wavread('aemixed.wav');
> time=(1:length(sig))'/fs;
>
> figure(1)
> plot(time,sig)
>
> fsig1 = fft(sig,fs);
> Y=real((ifft(fsig1,length(sig))));
> figure(3)
> plot(time,Y)
>
> What I don't understand is that Y and sig are not the same. Can someone
> please explain this to me. And some help as to
> to what to do to fsig1 so that when I take the ifft, the result is the
> same as sig.

You're confusing fs (sampling rate in Hz) with length (samples) when you call the fft()
function. Try:

  fsig1 = fft(sig);
  Y = real((ifft(fsig1)));

Note -- if the .wav file is long, this may not be what you want.  You may need to process the
.wav file in "frames"
with length that is meaningful relative to the nature of the data, a typical method for speech
and audio processing.

-Jeff


(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )

Re:Help with FFT and IFFT - Farrukh Aziz - Apr 14 10:10:39 2008

When you take FFT/IFFT, the result is a complex exponential ( a complex no : a+bi). When u
take IFFT of that, do not take it of real part of the previous signal only. Otherwise the
imaginary part would be clipped and you wont get the same signal.  So in general it should be
like
   
  x=FFT(a);
  y=IFFT(x);
   
  then you will get y=a.
   
  Farrukh



(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )

Re: Re:Help with FFT and IFFT - Jeff Brower - Apr 15 6:34:45 2008

Farrukh-

> When you take FFT/IFFT, the result is a complex exponential
> ( a complex no : a+bi). When u take IFFT of that, do not take it of real
> part of the previous signal only.

The OP didn't do that.

> Otherwise the imaginary part would be
> clipped and you wont get the same signal.  So in general it should be like
> 
>   x=FFT(a);
>   y=IFFT(x);
> 
>   then you will get y=a.

The OP started with a real-valued signal, then applied real() after the iFFT.  To use
your example, this would be:

  x = FFT(a);
  y = real(IFFT(x));

and you would still get y = a.

-Jeff
-------- Original Message --------
Subject: [matlab] Help with FFT and IFFT
Date: Sat, 12 Apr 2008 17:26:56 -0400
From: m...@gmail.com
Reply-To: m...@gmail.com
To: m...@yahoogroups.com

Hi!!

I am new to matlab so please bear with me. I don't understand the IFFT and FFT matlab
functions. Here is the code i am using:

[sig,fs]=wavread('aemixed.wav');
time=(1:length(sig))'/fs;

figure(1)
plot(time,sig)

fsig1 = fft(sig,fs);
Y=real((ifft(fsig1,length(sig))));
figure(3)
plot(time,Y)

What I don't understand is that Y and sig are not the same. Can someone please
explain this to me. And some help as to to what to do to fsig1 so that when I take
the ifft, the result is the same as sig.



(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )

Re: Help with FFT and IFFT - Jeff Brower - Apr 15 6:35:19 2008

Leelavathy-
> I am working with video watermarking. Can you please help me in suggesting how to
> separate a audio information from a  *.avi  file and relate it to video
> information. I am able to retrieve frames but I also want the audio signal
> separately.

Please post to the group, not to me.

-Jeff
> On 4/13/08, Jeff Brower <j...@signalogic.com> wrote:
>
>      Marciful-
>
>      > I am new to matlab so please bear with me. I don't understand the IFFT
>      > and FFT matlab functions. Here is the code i am using:
>      >
>      > [sig,fs]=wavread('aemixed.wav');
>      > time=(1:length(sig))'/fs;
>      >
>      > figure(1)
>      > plot(time,sig)
>      >
>      > fsig1 = fft(sig,fs);
>      > Y=real((ifft(fsig1,length(sig))));
>      > figure(3)
>      > plot(time,Y)
>      >
>      > What I don't understand is that Y and sig are not the same. Can someone
>
>      > please explain this to me. And some help as to
>      > to what to do to fsig1 so that when I take the ifft, the result is the
>      > same as sig.
>
>      You're confusing fs (sampling rate in Hz) with length (samples) when you
>      call the fft() function. Try:
>
>      fsig1 = fft(sig);
>      Y = real((ifft(fsig1)));
>
>      Note -- if the .wav file is long, this may not be what you want. You may
>      need to process the .wav file in "frames"
>      with length that is meaningful relative to the nature of the data, a
>      typical method for speech and audio processing.
>
>      -Jeff
>


(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )

Re: Help with FFT and IFFT - arkkimede - Apr 16 7:38:13 2008

I'm sorry for the delay.
I do not know what is your problem.
If you think is useful , you can read a tutorial for FFT that I submitted to
the The MathWorks web page.
I analyzed 3 case of FFT (time-symmetric signal, time-asymmetric signal and
periodic signal) verifying
that the numeric results are super imposable   to the analytic ones.
I analyzed also  the possibility to use the pair FFT-IFFT to translate the
signal of a quantity smaller than the  sampling  time.
(so in this tutorial I faced the problem of the IFFT).
I hope this will be useful for you
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=5654&objectType=fi
le

BR
Daniele

On Sat, Apr 12, 2008 at 11:26 PM, <m...@gmail.com> wrote:

>   Hi!!
>
> I am new to matlab so please bear with me. I don't understand the IFFT and
> FFT matlab functions. Here is the code i am using:
>
> [sig,fs]=wavread('aemixed.wav');
> time=(1:length(sig))'/fs;
>
> figure(1)
> plot(time,sig)
>
> fsig1 = fft(sig,fs);
> Y=real((ifft(fsig1,length(sig))));
> figure(3)
> plot(time,Y)
>
> What I don't understand is that Y and sig are not the same. Can someone
> please explain this to me. And some help as to to what to do to fsig1 so
> that when I take the ifft, the result is the same as sig.
>
>  
>


(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )