欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

DFS

程序员文章站 2022-03-19 13:22:07
...

DFS
DFS
DFS
DFS
matlab计算时,选一个主区间计算

function [Xk] = dfs(xn,N)
% Compute DFS
% Xk = DFS coeff. array over 0<=k<=N-1;
% xn = One period of periodic signal over 0<=n<=N-1;
% N = Fundamental period of xn
n = [0:1:N-1];
k = [0:1:N-1];
WN = exp(-1j*2*pi/N);
nk = n'*k;
WNnk = WN.^nk;
Xk = xn * WNnk;
end
function [xn] = idfs(Xk,N)
% Compute DFS
% Xk = DFS coeff. array over 0<=k<=N-1;
% xn = One period of periodic signal over 0<=n<=N-1;
% N = Fundamental period of xn
n = [0:1:N-1];
k = [0:1:N-1];
WN = exp(-1j*2*pi/N);
nk = n'*k;
WNnk = WN.^(-nk);
xn = (Xk * WNnk)/N;
end
clear all, close all, clc;

xn = [0,1,2,3];
N = 4;
xk = dfs(xn,N)
xn_1 = idfs(xk,N)
相关标签: 信号