is this is a bug for fft program?

조회 수: 1 (최근 30일)
chongyang zhang
chongyang zhang 2019년 8월 5일
편집: dpb 2019년 8월 5일
i am a student in china.
i get diffrent result when i run the code below:
fft([1,2,3,4],4).'
fft([1,2,3,4],4)'
the first:
10.0000 + 0.0000i
-2.0000 + 2.0000i
-2.0000 + 0.0000i
-2.0000 - 2.0000i
the 2th
10.0000 + 0.0000i
-2.0000 - 2.0000i
-2.0000 + 0.0000i
-2.0000 + 2.0000i
but i think it should be the same
could you tell me where is wrong?

채택된 답변

dpb
dpb 2019년 8월 5일
편집: dpb 2019년 8월 5일
See the documentation for
doc transpose % .'
doc ctranspose % '
You're transposing the output of the fft() which is complex; in Matlab the ' operator is the complex transpose whereas the "dot" version .' is non-complex transpose.
So, it is doing exactly what is documented to do--
ADDENDUM
And, to emphasize what SS said, the output of fft() itself is identical as would be expected--it was given identical inputs.
The transpose operators are applied to the output of fft(); it (fft, that is) has actually nothing whatsoever to do with the result at that point; its job was done and over before the interesting action occurred.
Same as if had written
>> complex(-2,2)
ans =
-2.0000 + 2.0000i
>> complex(-2,2)'
ans =
-2.0000 - 2.0000i
>> complex(-2,2).'
ans =
-2.0000 + 2.0000i
>>
which clearly demonstrates the properties of the transpose operators has nothing to do with the source of the data (and vice versa); it simply has to be a complex value before one can observe the difference since w/o an imaginary component the complex conjugate is a "do nothing" operation.
>> [1:4]
ans =
1 2 3 4
>> [1:4]'
ans =
1
2
3
4
>> [1:4].'
ans =
1
2
3
4
>>

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by