《DSP using MATLAB》Problem 5.12
1、从别的地方找的证明过程:
2、代码
function x2 = circfold(x1, N) %% Circular folding using DFT %% --------------------------------------------- %% x2 = circfold(x1, N) %% x2 = circulary folded output sequence %% x1 = input sequence of length <= N %% N = circular buffer length %% X1k_DFT = dft(x1, N); Xk = dft(X1k_DFT, N); x2 = Xk/N;
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info about this m-file fprintf('\n***********************************************************\n'); fprintf(' <DSP using MATLAB> Problem 5.12 \n\n'); banner(); %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ % -------------------------------------------------------------- % 1 x(n) = [1, 3, 5, 7, 9, -7, -5, -3, -1] % -------------------------------------------------------------- xx1 = [1, 3, 5, 7, 9, -7, -5, -3, -1]; NN1 = length(xx1); % length is 6 nn1 = [0 : NN1-1]; % ---------------------------------------------------- % 1st way to get Circulary folded % ---------------------------------------------------- xx1_cf = xx1( mod(-nn1, NN1)+1 ); figure('NumberTitle', 'off', 'Name', 'P5.12 x(n)') set(gcf,'Color','white'); subplot(2,1,1); stem(nn1, xx1); xlabel('n'); ylabel('x(n)'); title('x(n) ori sequence'); grid on; subplot(2,1,2); stem(nn1, xx1_cf); xlabel('n'); ylabel('x(n)'); title('x((-n))_N Circulary folded by mod way'); grid on; % ------------------------------------------------------ % 2nd way to get Circulary folded % DFT % ------------------------------------------------------ xx2 = circfold(xx1, NN1); figure('NumberTitle', 'off', 'Name', 'P5.12 x(n)') set(gcf,'Color','white'); subplot(2,1,1); stem(nn1, xx1); xlabel('n'); ylabel('x(n)'); title('x(n) ori sequence'); grid on; subplot(2,1,2); stem(nn1, xx2); xlabel('n'); ylabel('x(n)'); title('x((-n))_N Circulary folded by DFT way'); grid on;
运行结果:
牢记:
1、如果你决定做某事,那就动手去做;不要受任何人、任何事的干扰。2、这个世界并不完美,但依然值得我们去为之奋斗。