Forums

Why this particular code doesnt work?

Started by Sreeram February 28, 2006
sig=wavread('path to signal file');
reconstructed_sig=ifft(fft(sig));
subplot(2,1,sig);
plot(sig);
subplot(2,2.reconstructed_sig);
plot(reconstructed_sig);
	i know that to analyse the fft of sig, the magnitude and phase spectra 
of it must be found.But why is the ifft-fft combination not working?
What must i do so that i can reconstruct the original sig using ifft?

Thanx in advance
warrier
	
Please, look at the following link
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectIdV54&objectType=file
Here you can find ad example of what you are looking for
Bye

2006/2/28, Sreeram <warrier_is@warr...>:
>
> sig=wavread('path to signal file');
> reconstructed_sig=ifft(fft(sig));
> subplot(2,1,sig);
> plot(sig);
> subplot(2,2.reconstructed_sig);
> plot(reconstructed_sig);
>
>
> i know that to analyse the fft of sig, the magnitude and phase spectra
> of it must be found.But why is the ifft-fft combination not working?
> What must i do so that i can reconstruct the original sig using ifft?
>
> Thanx in advance
> warrier
>
	
syntactically the subplot statements should be 
  subplot(2,1,1); plot(1);
  subplot(2,1,2); plot(2);
  i ran your code with a random .wav file with the above plotting statements and
it works .. there might be some distortion because of .wav clipping

Sreeram <warrier_is@warr...> wrote: 
  sig=wavread('path to signal file');
reconstructed_sig=ifft(fft(sig));
subplot(2,1,sig);
plot(sig);
subplot(2,2.reconstructed_sig);
plot(reconstructed_sig);
	i know that to analyse the fft of sig, the magnitude and phase spectra 
of it must be found.But why is the ifft-fft combination not working?
What must i do so that i can reconstruct the original sig using ifft?

Thanx in advance
warrier