Plot spectral phase in Mtlab

  • Thread starter snatcos
  • Start date
  • #1
4
0
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));

figure
plot(x,ph);
figure
plot(X,PH);
end

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
 

Answers and Replies

Related Threads on Plot spectral phase in Mtlab

  • Last Post
Replies
2
Views
2K
Replies
2
Views
1K
Replies
1
Views
3K
  • Last Post
Replies
6
Views
105K
  • Last Post
Replies
9
Views
4K
  • Last Post
Replies
10
Views
7K
  • Last Post
Replies
1
Views
5K
  • Last Post
Replies
2
Views
4K
Replies
5
Views
1K
Top