how i can find the DTFT of sequence without using fft inbuilt function ?

59 views (last 30 days)
i am trying this code,
clc; clear; close all;
n = 0:1:100;
x = ((n >= 0) - (n >= 5));
stem(n, x);
len = length(x);
X = zeros(1, len);
for w = 0:2*pi*len
for n = 0:len
X(w+1) = X(w+1) + x(w+1)*exp(-1j*w*n);
end
end

Accepted Answer

sairaj burewar
sairaj burewar on 1 Mar 2018
w=-pi:0.01:pi;
n=0:50;
x=[1 2 3 4];
for i=1:length(w);
X(i)=0;
for k=1:length(x);
X(i)=X(i)+x(k).*exp(-j.*w(i).*n(k));
end
end
plot(w,X);
title('DTFT');

More Answers (2)

Abhishek Ballaney
Abhishek Ballaney on 1 Mar 2018
Edited: Abhishek Ballaney on 1 Mar 2018
https://blogs.mathworks.com/steve/2010/06/25/plotting-the-dtft-using-the-output-of-fft/
https://blogs.mathworks.com/steve/2010/03/15/the-dft-and-the-dtft/

Piotr Gregor
Piotr Gregor on 1 Jul 2022

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!