# You genius, I want to ask about cufft Conversion of one-dimensional problems

Hi ~ You genius, when I finish 1x5 One-dimensional matrices cufft , And then to carry it out and found it to display with MATLAB There is little difference, so I wanted to ask where I was out of the question, isn’t it experts who can help me thank you, the following is my code

#include <stdio.h>
#include <stdlib.h>
#include <cufft.h>
#define H 10
#define B 10

int main()
{

``````float a[H],b[H];
for(int i=0;i<H;i++)
{
a[i]=i+1;

}
cufftHandle plan;
cufftComplex *data;
cudaMalloc((void**)&data,sizeof(cufftComplex)*(H/2+1)*B);
cudaMemcpy(data,a,sizeof(cufftComplex)*(H/2+1),cudaMemcpyHostToDevice);
cufftPlan1d(&plan,H,CUFFT_R2C,B);
cufftExecR2C(plan, (cufftReal*)data, data);
cudaMemcpy(b,data,sizeof(cufftComplex)*(H/2+1),cudaMemcpyDeviceToHost);
for(int i=0;i<H;i++)
{
printf("b[%d]=%.4f\n",i,b[i]);
}
cudaFree(data);
cufftDestroy(plan);
system("PAUSE");
return 0;
``````

}
b[0]=55.0
b[1]=0.0
b[2]=-5.0
b[3]=15.4
b[4]=-5.0
b[5]=6.9
b[6]=-5.0
b[7]=3.6
b[8]=-5.0
b[9[=1.6

Matlab
a=[1,2,3,4,5,6,7,8,9,10]
as=fft(a)
55.0000 -5.0000 +15.3884i -5.0000 + 6.8819i

Columns 4 through 6

-5.0000 + 3.6327i -5.0000 + 1.6246i -5.0000

Columns 7 through 9

-5.0000 - 1.6246i -5.0000 - 3.6327i -5.0000 - 6.8819i

Column 10

-5.0000 -15.3884i