# How can I get the correct spectral phase variations of a super gaussian pulse?

2 views (last 30 days)
Uldooz reh on 27 Jul 2021
Answered: Paul on 28 Jul 2021
Hello,
I want to obtain the fft of a super gaussian pulse which is real and even and then plot spectral phase. The phase should be zero, however, what I got, even with unwrap angle, has nonzero value. Here is my code. Do you have any clue?
Ts = 1/1000; % sampling period (ps)
t = (-50:Ts:50); % temporal axis (ps)
x = exp(-(1+1i*0)/2*(t/10).^6); % Super-Gaussian (SG) temporal pulse
nfft = 2^(nextpow2(length(x)));
fs = 1/Ts; % sampling freq (Hz)
f = linspace(-fs/2*1e3,fs/2*1e3,numel(X)); % freq axis scaled in GHz
X = fftshift(fft(x,nfft));
plot(f, unwrap(angle(X)))
axis([-500 500 min(unwrap(angle(X))) max(unwrap(angle(X)))]);

Paul on 28 Jul 2021
The posted code doesn't run. The frequency vector f is defined in terms of numel(X), but X isn't defined yet.
I thing that introducing the zero padding with nextpow2 on only one side of the signal introduces some phase distortion. The code below doesn't use zero padding.
The values of X won't be exactly real because of computational innacuruacy. However, you can check that the imaginary part is very, very small relative to the real part in frequencies of interest, so the phase will be either 0 or +-180. But then unwrapping that causes problems. Don't unwrap.
Ts = 1/1000; % sampling period (ps)
t = (-50:Ts:50); % temporal axis (ps)
x = exp(-(1+1i*0)/2*(t/10).^6); % Super-Gaussian (SG) temporal pulse
%nfft = 2^(nextpow2(length(x)));
nfft = numel(x);
fs = 1/Ts; % sampling freq (Hz)
f = linspace(-fs/2*1e3,fs/2*1e3,nfft); % freq axis scaled in GHz
X = fftshift(fft(x,nfft));
subplot(211);plot(f,abs(X));
subplot(212);stem(f,180/pi*angle(X));
xlim([-500 500]);
If you're confident that X should be real, then maybe consider
X = abs(X) % or
X = real(X)

R2015a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!