How can I write dft code from k = -3 ~ 3 for A = [1 7 5 11 15 19 8]?

1 view (last 30 days)
Parisa PASHA
Parisa PASHA on 10 Oct 2016
Edited: Walter Roberson on 11 Oct 2016
I must use k = -3 ~ 3 in my code.
  4 Comments
Parisa PASHA
Parisa PASHA on 11 Oct 2016
It must be something like this:
x = [1 7 5 11 15 19 8];
N = length(x);
for k = -3:1:3
for n = 1:N
X(:,n) = exp(-2*pi*1i*n*k./N);
end
end
X

Sign in to comment.

Answers (1)

Pritesh Shah
Pritesh Shah on 10 Oct 2016
It should be -3:3
  1 Comment
Parisa PASHA
Parisa PASHA on 10 Oct 2016
But when I use k=-3:3 the error appear like this Attempted to access (-3); index must be a positive integer or logical.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!