Now I'm trying to understand and implement the zero-padding work in my example. As I know, meaningless zero values are affect to better DFT result. So I want to see how zero-padding works.
clear all clc fs = 50; %50Hz T = 1/fs; N = 8; t = (0:N-1)*T; y = 5+cos(2*pi*12.5*t)+sin(2*pi*18.75*t); X=zeros(1,N); for k = 0:N-1 for n = 0:N-1 X(k+1) = X(k+1) + y(n+1)*exp(-j*(2*pi/N)*k*n); end end x_mag = abs(X); f_2 = fs*(0:(N-1))/N; stem(f_2,x_mag,'-ok','linewidth',2,'MarkerFaceColor','black');
But I feel hard to implement the increasing zero padding in my example code. Would you please show me how I can increase the zero-pad?
I found the better result when I increased the $N$ number to 80 from 8. But I'm not sure if increasing $N$ means increasing the zero-pad.