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

조회 수: 1 (최근 30일)
Parisa PASHA
Parisa PASHA 2016년 10월 10일
편집: Walter Roberson 2016년 10월 11일
I must use k = -3 ~ 3 in my code.
  댓글 수: 4
Parisa PASHA
Parisa PASHA 2016년 10월 11일
In Discrete Fourier Transform K=0:N-1 but I need to write a code in different way from K=-3:3.
Parisa PASHA
Parisa PASHA 2016년 10월 11일
편집: Walter Roberson 2016년 10월 11일
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

댓글을 달려면 로그인하십시오.

답변 (1개)

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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by