Bug of matlab coder (2013a) for IFFT?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dear all,
I am trying to use the matlab coder to generate C++ code for IFFT. However, results from matlab and C++ code have greate difference. Could anyone help me to take a look at this problem?
The matlab code to do IFFT is as follows:
z=ifft(y,[],1);
The data of y are as follows:
487924.35768878186
481026.24091831001
478940.94803639117
480926.64214804117
478909.92810891091
475591.66558611894
472961.12419697485
478082.98773687298
475963.06721005152
471624.91585664771
473035.01798060897
470885.04387918825
465204.72500935785
465559.98854017764
468284.20173525374
467779.54004903068
467358.62894582795
461658.53205369966
461058.87787927384
461185.53453021083
455868.37107306172
462911.95616388740
459834.12223788921
458194.44688116410
456595.68046306813
451450.72108931403
448915.17218837264
451224.11133871856
448603.78107835044
442943.27244258055
445878.56931863062
451008.71128154272
451212.54731590918
455779.62766682287
454335.89646260266
450941.74302688910
451440.15563114837
451448.07972477260
449064.57034377591
448331.01187180565
449871.73269351595
449496.69114039827
445229.11575907044
444080.89526586136
443461.78518676467
437449.62073759746
443516.19085396524
438574.10116169654
434403.16106846917
433751.71037962160
426817.29095258669
422633.17624841497
418137.67043422104
413457.43016094179
411045.60664053162
403724.29173170537
392643.02660994284
380096.57725000178
357723.60756075662
332111.19753204676
317106.73298398359
311326.13889686763
311656.30946454400
310753.51039134728
313637.04296473821
311065.22361899650
310994.64764692046
309178.16192473430
310382.78521443135
310153.53409929451
308257.54974676436
309423.90546237369
310570.45094392239
308946.62377444573
310466.56800921442
309782.13247536187
320356.73878161400
347570.20226357155
368694.03200706805
384869.13643517962
398566.44765287120
407737.20091712585
412582.04329780280
418070.05794431345
422272.98431790201
424134.63093139383
430451.22874984005
433175.44194491615
437468.43240701430
438150.54869395244
439138.45124420297
443049.79674182995
441973.82723235723
440130.96007651964
447706.58685186348
449457.42500166676
454555.58068421762
449613.45878018625
452690.29414154071
451600.11924471724
452466.32575548667
454145.23503918055
449159.24071435159
456451.88715437474
450130.32872447267
450516.57997100998
452118.30987127440
449933.06388969702
452284.90910795948
452236.75252272276
453562.39540488424
455035.18161905993
456251.33671980369
457868.23836029979
460014.57253253541
462557.04696245730
461771.33764667553
462317.90683617146
466403.38912295533
467626.46975267958
466153.36142087687
467724.10360542370
470285.06758713548
469912.31306916947
469812.71429890068
469016.11740732624
470695.70313803683
473460.18103648809
475000.22541118169
476990.88013428752
477611.31089565484
475078.08124162792
479902.43694122758
478081.34493697528
480799.95328534150
484503.82281941688
Thanks, Tang Laoya
0 comentarios
Respuestas (3)
Sean de Wolski
el 1 de Ag. de 2013
Editada: Sean de Wolski
el 1 de Ag. de 2013
I'm not surprised to see a small difference. Building a mex file from this:
function y = doIFFT(x)
y = ifft(x,2^nextpow2(numel(x)),1);
%I had to add the nextpow2 part to get it to build
end
Then looking at the differences:
norm(doIFFT(x)-doIFFT_mex(x))
ans =
4.695591604029106e-11
The difference is very small. In fact it's close to:
eps(487924.35768878186)
So this is just a small numerical round-off difference in the approach taken by the libraries MATLAB sits on and the generated c-code.
0 comentarios
laoya
el 1 de Ag. de 2013
Editada: laoya
el 1 de Ag. de 2013
4 comentarios
Sean de Wolski
el 1 de Ag. de 2013
If you download the same file from here:
Then you can make changes to it since it's covered under BSD.
Ver también
Categorías
Más información sobre Simulink Coder en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!