Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8443381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:07:24+00:00 2026-06-10T09:07:24+00:00

I have an app that I am developing that utalizes Apple’s Accelerate Framework FFT

  • 0

I have an app that I am developing that utalizes Apple’s Accelerate Framework FFT function and I am trying to make it mimic the functionality of Matlab’s FFT function. I have my current code set up to output exactly the same way as I am doing so in matlab. The only time that it doesn’t output identically is when the number of elements in the data array are != a logarithm of base 2 (technically necessary for an FFT). I was wondering if anyone knew how the Matlab Function handled this case. If I do it using the apple code, it produces different results.

Note: I am not simply calling fft(x). I also FFT shift and take the absolute value and square it. I also mirror these in the apple code because they aren’t directly affected by the FFT. They are called after the fact.

Example 1 – 16 Elements (Log base 2): Similar Output

Matlab Call:

x = 1:16;
Fxx = abs(fftshift(fft(x))).^2;

Fxx =

  Columns 1 through 7

64    66.5322    74.9807    92.5736    128    207.3490    437.0193

 Columns 8 through 14

1681.5451    18496    1682.5451    437.0193    207.3490    128    92.5736

  Columns 15 through 16

74.9807    66.5322

*Apple code omitted due to length

Apple Output:

Fxx[0] = 64.000000
Fxx[1] = 66.532232
Fxx[2] = 74.980664
Fxx[3] = 92.573612
Fxx[4] = 128.000000
Fxx[5] = 207.349044
Fxx[6] = 437.019336
Fxx[7] = 1681.545112
Fxx[8] = 18496.000000
Fxx[9] = 1681.545112
Fxx[10] = 437.019336
Fxx[11] = 207.349044
Fxx[12] = 128.000000
Fxx[13] = 92.573612
Fxx[14] = 74.980664
Fxx[15] = 66.532232

Example 2 – 10 Elements (NOT Log base 2): Different Output

Matlab Call:

x = 1:10;
Fxx = abs(fftshift(fft(x))).^2;

Fxx = 

Columns 1 through 7

25    27.6393    38.1966    72.3607    261.8034    3025    261.8034

Columns 8 through 10

72.3607    38.1966    27.6393

*Apple code omitted due to length

Apple Output:

Fxx[0] = 16.000000
Fxx[1] = 45.250000
Fxx[2] = 18.745166
Fxx[3] = 32.000000
Fxx[4] = 109.254834
Fxx[5] = 1296.000000
Fxx[6] = 109.254834
Fxx[7] = 32.000000
Fxx[8] = 18.745166
Fxx[9] = 45.250000

As you can see, they clearly produce the same output in the first example vs the second. I have tested with both positive and negative inputs and the only time they are different is when they are NOT log base 2. Does anyone know how Matlab handles this problem? Perhaps it fills the array with 0’s until its a log base 2 number and then do the average of certain points? I have done lots of searching and cannot figure out what they do to obtain their output in this special case.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T09:07:25+00:00Added an answer on June 10, 2026 at 9:07 am

    From the official MATLAB documentation:

    The FFT functions (fft, fft2, fftn, ifft, ifft2, ifftn) are based on a library called FFTW.

    To compute an N-point DFT when N is composite (that is, when N = N1N2), the FFTW library decomposes the problem using the Cooley-Tukey algorithm, which first computes N1 transforms of size N2, and then computes N2 transforms of size N1.

    When N is a prime number, the FFTW library first decomposes an N-point problem into three (N – 1)-point problems using Rader’s algorithm. It then uses the Cooley-Tukey decomposition described above to compute the (N – 1)-point DFTs.

    I’m not sure how Apple’s Accelerate Framework computes such FFTs, but I’m favouring MATLAB here to produce correct results.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that I am developing in Visual Studio 2008, but the
I have a 2.3.3 android app that I am developing that I would like
I started developing an android app that have to interact with MMS attachements, in
I have a little Problem with the app that I'm developing. In the App
I have a winforms (VB 2008) based app that I'm developing and I want
I am developing a web app that will have two parts running on two
I am developing an plugin for OsiriX . In that app i have 3-4
Good evening, In my app that I'm currently developing, I have a class that
I have a DB in a Rails app I'm developing that had a product_type
I am developing native iPhone app. I have one requirement that, there are 5

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.