Computing the PSD of the interpolated signal

4 views (last 30 days)
Clay
Clay on 20 Jul 2012
Commented: Will Ojemann on 25 Jul 2022
Hello everyone, I'm having difficulty plotting the PSD. So I have some subcarriers that I'm populating int the freq domain. I'm taking it to the time domain by taking the ifft to interpolate the signal. Then I'm taking that interpolated signal back to the freq domain and I want to compute the PSD. I think the problem is I'm not scaling it, but I really don't know. Can anyone please help? I'm putting the code below as well.
Thank you
%populate subcarriers A = zeros(fft_size); for n=1:fft_size A(n) = 0.000001; end
for n=244:756 % place them in the middle sub1 = rand; subi = rand; if (sub1 < 0.5) sub1 = -1; else sub1 = 1; end if (subi < 0.5) subi = -1; else subi = 1; end A(n) = complex(sub1,subi); end
%plot ideal output PSD B = zeros(1,1000); for n=1:1000 B(n) = real(A(n))^2 + imag(A(n))^2; end t_1 = 0:0.001:0.999; subplot(2,2,1); plot(t_1,log(B));
%go to time domain to interpolate time_d = ifft(A);
interpolated = upfirdn(time_d,b,8);
%go back to the freq domain freq_d = fft(interpolated);
% compute the PSD D=abs(freq_d); D2 = D.^2;
%plot the PSD of the interpolated signal
  2 Comments
Clay
Clay on 20 Jul 2012
Oh I do have the coeffs for the interpolation process, I just didn't upload them here
Will Ojemann
Will Ojemann on 25 Jul 2022
First: in the first line I would just say "A = ones(1,fft_size) / 1e6;"
Second: in the future it helps to avoid "magic numbers" like 244:756 to ensure scalability of the code and interpretability
Third: When plotting FFTs in matlab you have to take into account the output format of the function w.r.t scaling (like you mentioned), taking the absolute value, and either plotting after FFTshifting or defining a frequency spectrum to plot over. Without seeing what the problem is it is impossible to directly address the problem you're having.
(more inormation here)
https://www.mathworks.com/help/matlab/ref/fft.html

Sign in to comment.

Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!