恰逢清明,这几天是清明时节雪纷纷,断崖式降温;又回到了老家,儿时上蹿下跳的核桃树,远去的故乡,远去的时代……
用到的公式:
这里只放前两个小题的计算过程,都比较简单,细心就行。代码如下:
%% ------------------------------------------------------------------------ %% Output Info about this m-file fprintf(‘\n***********************************************************\n‘); fprintf(‘ <DSP using MATLAB> Problem 5.1 \n\n‘); banner(); %% ------------------------------------------------------------------------ % ------------------------------------ % x1(n) % ------------------------------------ xn = [4, 1, -1, 1]; N =4; Xk_1 = dfs(xn,N) % ------------------------------------ % x2(n) % ------------------------------------ xn = [2, 0, 0, 0, -1, 0, 0, 0]; N = 8; Xk_2 = dfs(xn,N) % ------------------------------------ % x3(n) % ------------------------------------ xn = [1, 0, -1, -1, 0]; N = 5; Xk_3 = dfs(xn,N) % ------------------------------------ % x4(n) % ------------------------------------ xn = [0, 0, 2*j, 0, 2*j, 0]; N = 6; Xk_4 = dfs(xn,N) % ------------------------------------ % x5(n) % ------------------------------------ xn = [3, 2, 1]; N = 3; Xk_5 = dfs(xn,N)
运行结果: