Matlab coder C conversion of an fft

1 次查看(过去 30 天)
Can someone give me an example of what an fft should look like within a coder converted c code snippet? I am aware that the documentation says that fft is coder compatible, but I have not yet obtained successful results. What I end up receiving from coder is simply a copy of the input data. any help would be welcome. An example of what I have been testing is below.
function anFFT= fft_soundfile(input)
anFFT = input;
%do fft
X = abs(fft(input,1024));
%fft end
holder = X(1);
%data = abs(y)
end
What I am getting is as follows
/*
* Academic License - for use in teaching, academic research, and meeting
* course requirements at degree granting institutions only. Not for
* government, commercial, or other organizational use.
*
* anFFT.c
*
* Code generation for function 'anFFT'
*
*/
/* Include files */
#include "rt_nonfinite.h"
#include "anFFT.h"
/* Function Definitions */
void anFFT(const double input[27387], double b_anFFT[27387])
{
memcpy(&b_anFFT[0], &input[0], 27387U * sizeof(double));
/* do fft */
/* fft end */
/* data = abs(y) */
}
/* End of code generation (anFFT.c) */
This doesn't seem to be generating an fft. Can anyone help with this?

采纳的回答

Walter Roberson
Walter Roberson 2017-6-12
You have
function anFFT= fft_soundfile(input)
anFFT = input;
so your output is a copy of your input. Nothing you do later in your code affects the output. Everything after that point is optimized away.
  1 个评论
Tommy Owens
Tommy Owens 2017-6-12
Thank you, as you can probably tell with this mistake; I am new to using MATLAB. That easily fixed my problem.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Coder 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by