does function "fft" support int16 data type?
이전 댓글 표시
Hi,
I have MATLAB R2016b. When I was using "fft" function, I got an error message : "Undefined function 'fft' for input arguments of type 'int16'"
The error message disappears if I convert my data to double.
However, I am a bit confused that when I looked at "fft" help page, it does say that "int16" is supported for the input.
Can anyone please help me understand this?
thanks, L
답변 (2개)
David Goodmanson
2017년 8월 24일
편집: David Goodmanson
2017년 8월 24일
0 개 추천
Hello L,
2016b works for uint16 but not int16 on input. 2017a works for both int16 and uint16. Presumably the documentation page refers to the latest version of Matlab.
Of course in the cases that work, the output is an array of doubles.
댓글 수: 3
Big dream
2017년 10월 20일
Hello David,
I've already installed MATLAB 2017a, and i used the FFT() with int16. But when i compare the result AfterIfft between using DataTest as in int16 and as double, it's shown quiet big difference. Here are the code and the result after
DataTest=(fft(InputTest,512));
%// Envelope initialisation--> Halbe Frequenzspektren
DataTest =DataTest(1:256);
%// Inverse fft (dynamic scaling)
AfterIfft=ifft(DataTest,512);
end
% Here is a result of AfterIfft
AfterIfft(204)= 600,206118497517 + 65,8572349498327i %using double
AfterIfft(204)= 509 - 54i %using int16
When i use the absolute function, the results have almost 100 gap. Do you know how FFT() works in MATLAB using difference type variable? Or maybe when i use integer as a type of variable, should i set a parameter first?
Thanks,
Jan
2017년 10월 20일
@Big dream: Please post a working example.
David Goodmanson
2017년 10월 20일
Hello Bigdream,
I think there must be something else going on. In 2017a,
a = round(100*rand(1,256)); % integer doubles
a16 = int16(a);
z = fft(a,512);
z16 = fft(a16,512);
max(abs(z-z16))
ans = 0
gives perfect agreement. Of course
a = (100*rand(1,256)); % doubles but not integers
a16 = int16(a);
etc.
doesn't work since int16 does rounding and the two input arrays are not the same.
카테고리
도움말 센터 및 File Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!