Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Plot spectral phase in Mtlab

  1. Mar 12, 2012 #1
    Hi everyone,

    I have this Matlab code :

    function PH = testing
    close all;
    x = [0:1e-3:10-1e-3];
    ph = -(x-5).^2;
    y = exp(-(x-5).^2./(0.2^2)).*exp(i*2*pi*ph);

    Y = fft(y);
    Y = fftshift(Y);
    PH = angle(Y);
    X = (x(2) - x(1))^-1*linspace(0,1,length(x));


    I build a gaussian curve with quadratic phase and Fourier Transform it. I expect to have a quadratic phase (with opposite sign) in the spectral domain, but I cannot have it correctly. The plot of PH shows jumps between adjacent points. Even using unwrap.m I cannot plot it well.

    Thanks in advance for any help
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted