0% found this document useful (0 votes)
84 views2 pages

Matlab

The document contains MATLAB code definitions for functions that compute discrete transforms and their inverses including: - dtft(x,n,w) computes the discrete-time Fourier transform of a finite sequence x at frequencies w. - dft(xn,N) computes the discrete Fourier transform of a finite sequence xn of length N. - dfs(xn,N) computes the discrete Fourier series coefficients of a periodic signal xn with period N. - idfs(Xk,N) computes the inverse discrete Fourier series of coefficients Xk with period N. - idft(Xk,N) computes the inverse discrete Fourier transform of coefficients Xk of length N.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views2 pages

Matlab

The document contains MATLAB code definitions for functions that compute discrete transforms and their inverses including: - dtft(x,n,w) computes the discrete-time Fourier transform of a finite sequence x at frequencies w. - dft(xn,N) computes the discrete Fourier transform of a finite sequence xn of length N. - dfs(xn,N) computes the discrete Fourier series coefficients of a periodic signal xn with period N. - idfs(Xk,N) computes the inverse discrete Fourier series of coefficients Xk with period N. - idft(Xk,N) computes the inverse discrete Fourier transform of coefficients Xk of length N.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

function [X] = dtft(x,n,w)

% Computes Discrete-time Fourier Transform


% [X] = dtft(x,n,w)
% X = DTFT values computed at w frequencies
% x = finite duration sequence over n
% n = sample position vector
% w = frequency location vector
X=x*exp(-j*n'*w)

function [Xk] = dft(xn,N)


% Computes Discrete Fourier Transform
% -----------------------------------
% [Xk] = dft(xn,N)
% Xk = DFT coeff. array over 0 <= k <= N-1
% xn = N-point finite-duration sequence
% N = Length of DFT
%
n = [0:1:N-1]; % row vector for n
k = [0:1:N-1]; % row vecor for k
WN = exp(-j*2*pi/N); % Wn factor
nk = n'*k; % creates a N by N matrix of nk values
WNnk = WN .^ nk; % DFT matrix
Xk = xn * WNnk; % row vector for DFT coefficients

function [Xk] = dfs(xn,N)


% Computes Discrete Fourier Series Coefficients
% ---------------------------------------------
% [Xk] = dfs(xn,N)
% 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]; % row vector for n
k = [0:1:N-1]; % row vecor for k
WN = exp(-j*2*pi/N); % Wn factor
nk = n'*k; % creates a N by N matrix of nk values
WNnk = WN .^ nk; % DFS matrix
Xk = xn * WNnk; % row vector for DFS coefficients

function [xn] = idfs(Xk,N)


% Computes Inverse Discrete Fourier Series
% ----------------------------------------
% [xn] = idfs(Xk,N)
% xn = One period of periodic signal over 0 <= n <= N-1
% Xk = DFS coeff. array over 0 <= k <= N-1
% N = Fundamental period of Xk
%
n = [0:1:N-1]; % row vector for n
k = [0:1:N-1]; % row vecor for k
WN = exp(-j*2*pi/N); % Wn factor
nk = n'*k; % creates a N by N matrix of nk values
WNnk = WN .^ (-nk); % IDFS matrix
xn = (Xk * WNnk)/N; % row vector for IDFS values
function [xn] = idft(Xk,N)
% Computes Inverse Discrete Transform
% -----------------------------------
% [xn] = idft(Xk,N)
% xn = N-point sequence over 0 <= n <= N-1
% Xk = DFT coeff. array over 0 <= k <= N-1
% N = length of DFT
%
n = [0:1:N-1]; % row vector for n
k = [0:1:N-1]; % row vecor for k
WN = exp(-j*2*pi/N); % Wn factor
nk = n'*k; % creates a N by N matrix of nk values
WNnk = WN .^ (-nk); % IDFT matrix
xn = (Xk * WNnk)/N; % row vector for IDFT values

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy