Matlab coder C conversion of an fft

조회 수: 1 (최근 30일)
Tommy Owens
Tommy Owens 2017년 6월 12일
댓글: Tommy Owens 2017년 6월 12일
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