-1
$\begingroup$

what is the reason for that? The gain should increase ideally I guess.

This is the code I tried. As I increase the length of F by zero padding,the gain of PSD reduces.

A=["48","03","0C","F6","00","F5","40","02","04","02","94","F4","D0","F5","2C","03","50","01","38","F4","24","F7","14","04","80","00","F4","F3","5C","F8","C4","04","28","FF","84","F3","08","F9","6C","04","EC","FD","CC","F2","2C","FA","E4","04","44","FC","C4","F2","1C","FC","6C","05","E4","FB","08","F3","40","FD","60","05","5C","FA","20","F3","70","FE","C8","04","A4","F8","04","F3","1C","FF","F0","03","84","F7","D4","F3","84","00","DC","03","2C","F7","00","F5","18","02","24","03","BC","F5","88","F5","08","03","78","02","20","F5","40","F6","34","03","D0","00","08","F4","5C","F7","0C","04","DC","FF","98","F3","7C","F8","C8","04","F8","FE","48","F3","F0","F9","34","05","70","FD","C8","F2","40","FB","40","05","24","FC","C0","F2","DC","FB","F4","04","18","FB","E4","F2","70","FD","D4","04","A8","F9","54","F3","F4","FE","FC","04","68","F8","50","F3","0C","00","34","04","50","F7","80","F3","BC","00","54","03","00","F6","8C","F4","48","02","60","03","CC","F5","A0","F5","14","03","D8","01","44","F4","28","F7","D0","03","70","00","44","F4","E0","F7","70","04","D4","FF","6C","F3","A8","F8","E8","04","9C","FE","3C","F3","38","FA","2C","05","FC","FC","EC","F2","38","FB","0C","05","20","FC","C4","F2","80","FC","24","05","40","FA","BC","F2","14","FE","1C","05","38","F9","10","F3","F8","FE","94","04","38","F8","D0","F3","80","00","0C","04","70","F7","68","F4","24","01","F0","02","CC","F5","BC","F4","CC","01","FC","01","18","F5","14","F6","70","03","6C","01","68","F4","60","F7","24","04","BC","00","0C","F4","3C","F8","A8","04","80","FF","9C","F3","50","F9","C4","04","98","FD","8C","F2","78","FA","0C","05","98","FC","E8","F2","E8","FB","20","05","80","FB","2C","F3","B4","FD","B0","05","80","FA","F4","F2","58","FE","D8","04","C0","F8","24","F3","4C","FF","CC","03","78","F7","1C","F4","B4","00","DC","03","14","F7","A0","F4","E8","01","1C","03","D8","F5","6C","F5","30","03","A0","01","0C","F4","FC","F5","5C","03","F0","00","14","F4","50","F7","E0","03","C8","FF","DC","F3","C8","F8","AC","04","AC","FE","60","F3","0C","FA","A8","05","F0","FD","44","F3","40","FB","54","05","88","FC","04","F3","04","FC","2C","05","CC","FA","80","F2","3C","FD","00","05","CC","F9","5C","F3","D8","FE","6C","04","5C","F8","B4","F3","44","00","6C","04","AC","F7","3C","F4","00","01","90","03","5C","F6","CC","F4","FC","01","7C","02","50","F5","C4","F5","E8","02","74","01","94","F4","B0","F6","C4","03","AC","00","E0","F3","FC","F7","38","04","70","FF","64","F3","E4","F8","E4","04","90","FE","1C","F3","1C","FA","08","05","FC","FC","EC","F2","4C","FB","F0","04","F0","FB","3C","F3","F4","FC","9C","05","C0","FA","04","F3","40","FE","E8","04","48","F9","54","F3","44","FF","80","04","BC","F7","6C","F3","5C","00","EC","03","0C","F7","30","F4","1C","01","04","03","30","F6","60","F5","C8","02","C4","02","EC","F4","04","F6","5C","03","60","01","4C","F4","E8","F6","DC","03","D8","FF","98","F3","3C","F8","54","04","18","FF","74","F3","4C","F9","E4","04","28","FE","38","F3","74","FA","0C","05","E0","FC","28","F3","30","FC","7C","05","58","FB","6C","F2","0C","FD","98","05","4C","FA","18","F3","50","FE","64","04","BC","F8","68","F3","8C","FF","9C","04","20","F8","40","F4","CC","00","98","03","E0","F6","EC","F4","DC","01","D4","02","B0","F5","50","F5","E8","02","2C","02","AC","F4","08","F6","28","03","0C","01","28","F4","A0","F7","20","04","E4","FF","94","F3","8C","F8","6C","04","78","FE","78","F3","14","FA","E0","04","74","FD","60","F2","9C","FA","3C","05","30","FC","9C","F2","40","FC","E0","04","48","FB","28","F3","90","FD","0C","05","BC","F9","1C","F3","FC","FE","DC","04","A0","F8","D8","F3","3C","00","18","04","54","F7","58","F4","2C","01","80","03","2C","F6","80","F4","0C","02","C0","02","88","F5","A0","F5","E8","02","68","01","94","F4","EC","F6","1C","04","E8","00","FC","F3","E0","F7","8C","04","9C","FF","7C","F3","FC","F8","BC","04","0C","FE","E4","F2","D8","F9","0C","05","70","FD","C8","F2","EC","FA","20","05","CC","FB","98","F2","B8","FC","68","05","A0","FA","D0","F2","E8","FD","F4","04","24","F9","3C","F3","7C","FF","A4","04","18","F8","AC","F3","1C","00","A4","03","2C","F7","7C","F4","5C","01","84","03","78","F6","78","F5","54","02","6C","02","58","F5","EC","F5","3C","03","78","01","04","F4","FC","F6","10","04","24","00","94","F3","CC","F7","34","04","0C","FF","64","F3","84","F9","0C","05","0C","FE","10","F3","BC","FA","34","05","B4","FC","44","F3","F8","FB","04","05","EC","FA","88","F2","18","FD","34","05","00","FA","C4","F2","50","FE","D8","04","F0","F8","8C","F3","9C","FF","50","04","F8","F7","44","F4","1C","01","C4","03","7C","F6","94","F4","B8","01","84","02","6C","F5","8C","F5","CC","02","28","02","BC","F4","54","F6","D4","03","5C","01","68","F4","8C","F7","04","04","D0","FF","D8","F3","B8","F8","A4","04","74","FE","EC","F2","B8","F9","1C","05","70","FD","AC","F2","D8","FA","2C","05","1C","FC","A4","F2","AC","FC","9C","05","2C","FB","D8","F2","7C","FD","20","05","A0","F9","38","F3","08","FF","5C","04","F0","F7","64","F3","3C","00","E0","03","54","F7","40","F4","B8","00","40","03","B0","F6","40","F5","08","02","B0","02","3C","F5","70","F5","0C","03","F8","01","24","F5","F8","F6"];
B=A';
C1 = reshape(A,2,[])';
C=[C1(:,2) C1(:,1)];
D=join(C);   %512*1
E=regexprep(D,'[^\w'']','');  %remove spaces
F=hex2dec(E);   %hex2dec

N = length(F);
xdft = fft(F);
xdft = xdft(1:N/2+1);
psdx = (1/(Fs*N)) * abs(xdft).^2;
psdx(2:end-1) = 2*psdx(2:end-1);
freq = 0:Fs/length(F):Fs/2;
figure
plot(freq,20*log10(psdx))
grid on
title('Periodogram Using FFT')
xlabel('Frequency (Hz)')
ylabel('Power/Frequency (dB/Hz)')
$\endgroup$
9
  • $\begingroup$ Possible duplicate of MATLAB: $\tt fft$ and $\tt ifft$ scaling $\endgroup$ Commented Jul 18, 2017 at 9:07
  • $\begingroup$ i read the info from the link,i am unable to link to my question,when i double the no of points in fft there shud be a 3db gain in psd,but in matlab it shows an exact 3db loss $\endgroup$ Commented Jul 18, 2017 at 10:37
  • $\begingroup$ Can you please show us how you are forming F ? $\endgroup$
    – Peter K.
    Commented Jul 18, 2017 at 11:17
  • $\begingroup$ @AkshayRathod no, there's nothing that says you should have a "gain". Mathematically justify that claim, and then check against the documentation of the fft function you're using. $\endgroup$ Commented Jul 18, 2017 at 16:00
  • $\begingroup$ @MarcusMüller the formula for fft gain is 10log(M/2)..where M is the no of points..for details pls visit this page,it has somewhat given the answer. designnews.com/aerospace/where-does-fft-process-gain-come/… $\endgroup$ Commented Jul 19, 2017 at 5:44

1 Answer 1

2
$\begingroup$

There is gain, and there is level, assuming you are asking about the bin levels, consider Parseval's theorem,

https://en.wikipedia.org/wiki/Parseval%27s_theorem

for the DFT,

$$ \sum_{n=0}^{N-1} | x[n] |^2 = \frac{1}{N} \sum_{k=0}^{N-1} | X[k] |^2 $$

when you increase $N$ by zero padding, you increase the denominator on the right, which reduces the levels.

$\endgroup$
1
  • $\begingroup$ this is very nice info..thanx $\endgroup$ Commented Jul 19, 2017 at 5:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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