0
$\begingroup$

I am plotting a FFT of a sampled RC pulse but my resulting spectrum isn't symmetric - it's offset.

pulse = rcosdesign(.5, 6, 100)
T = .0001
ft = fft(pulse);
ft = fftshift(ft)
ft_mag = abs(ft);
freq = 1/(T*length(pulse))*(-length(pulse)/2:(length(pulse)/2-1))

plot(freq,ft_mag)

What's going on?

$\endgroup$
  • $\begingroup$ what's rcosdesign function ? $\endgroup$ – Fat32 Apr 13 at 9:59
0
$\begingroup$

The problem comes from the DFT size. Try the code below that uses power of 2 fft.

T = 1e-4;   
fs = 1/T;
pulse = rcosdesign(.5, 6, fs);
L = length(pulse);
Nfft = 2^nextpow2(L);
ft = fft(pulse,Nfft);
ft = fftshift(ft);
ft_mag = abs(ft);
freq=(-Nfft/2:Nfft/2-1)/Nfft*fs;
plot(freq,ft_mag)
axis([-3 3 0 max(ft_mag)])
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.