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$
2
  • $\begingroup$ what's rcosdesign function ? $\endgroup$
    – Fat32
    Apr 13 '19 at 9:59
  • $\begingroup$ How is it offset? $\endgroup$
    – TimWescott
    Jan 8 '20 at 23:16
1
$\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$
1
$\begingroup$

Please check the type of "pulse". Is it a real type or complex type?

I do not know what your "rcosdesign()" looks like, and I used "pulse = rand(1,99)" and got:

enter image description here

$\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.