Matlab FFT function does not give the correct result

Started by shakes_ck May 16, 2007
Hi,
 I am trying to plot my signal(sum of two sines of different frequencies)
in the the frequency domain using FFT function of matlab.
 The magnitude plot -> y_mag = real(fft(x,N)
 is giving correct result.
 But the phase plot -> y_phase = imag(fft(x,N));
 is not giving correct result.....
 Can someone help me..?

Thanks & Regards,
shakes_ck

_____________________________________
Do you know a company who employs DSP engineers?  
Is it already listed at http://dsprelated.com/employers.php ?
On 16 mai, 12:38, "shakes_ck" <chandrasheka...@patni.com> wrote:
> Hi,
Hi,
> I am trying to plot my signal(sum of two sines of different frequencies) > in the the frequency domain using FFT function of matlab. > The magnitude plot -> y_mag = real(fft(x,N) > is giving correct result. > But the phase plot -> y_phase = imag(fft(x,N)); > is not giving correct result..... > Can someone help me..?
You make an error when you resp. compute the magnitude and the phase of your fft using the real and imaginary part of it. To obtain the magnitude plot, you should use the modulus of your Fourier signal: y_mag = abs(ff((x,N)); For the phase plot, you should use the function angle: y_phase = angle(fft(x,N)); or the unwrapped phase using the matlab function unwrap: y_phase = unwrap(angle(fft(x,N)));
> > Thanks & Regards, > shakes_ck >
Matthieu
shakes_ck wrote:
> Hi, > I am trying to plot my signal(sum of two sines of different frequencies) > in the the frequency domain using FFT function of matlab. > The magnitude plot -> y_mag = real(fft(x,N) > is giving correct result. > But the phase plot -> y_phase = imag(fft(x,N)); > is not giving correct result..... > Can someone help me..?
Are you accounting for phase wrapping? Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
shakes_ck wrote:
> Hi, > I am trying to plot my signal(sum of two sines of different frequencies) > in the the frequency domain using FFT function of matlab. > The magnitude plot -> y_mag = real(fft(x,N) > is giving correct result. > But the phase plot -> y_phase = imag(fft(x,N)); > is not giving correct result..... > Can someone help me..?
Are you accounting for phase wrapping? Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
On 16 mai, 12:38, "shakes_ck" <chandrasheka...@patni.com> wrote:
> Hi,
Hi,
> I am trying to plot my signal(sum of two sines of different frequencies) > in the the frequency domain using FFT function of matlab. > The magnitude plot -> y_mag = real(fft(x,N) > is giving correct result. > But the phase plot -> y_phase = imag(fft(x,N)); > is not giving correct result..... > Can someone help me..?
You make an error when you resp. compute the magnitude and the phase of your fft using the real and imaginary part of it. To obtain the magnitude plot, you should use the modulus of your Fourier signal: y_mag = abs(ff((x,N)); For the phase plot, you should use the function angle: y_phase = angle(fft(x,N)); or the unwrapped phase using the matlab function unwrap: y_phase = unwrap(angle(fft(x,N)));
> > Thanks & Regards, > shakes_ck >
Matthieu
Hi,
 I am trying to plot my signal(sum of two sines of different frequencies)
in the the frequency domain using FFT function of matlab.
 The magnitude plot -> y_mag = real(fft(x,N)
 is giving correct result.
 But the phase plot -> y_phase = imag(fft(x,N));
 is not giving correct result.....
 Can someone help me..?

Thanks & Regards,
shakes_ck

_____________________________________
Do you know a company who employs DSP engineers?  
Is it already listed at http://dsprelated.com/employers.php ?