This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How can I extend the range of the fft result graph of x-axis?

Hi Devzone!

I'm using the fft function to check the frequency of sound from mic sensor.

All seems good but, only up to 2500hz is shown and the frequency above it is shifted to the left and when it reaches to 0, it is shifted to the right.

When I used fpu-fft, and generated sin function, the graph can show the value up to 20000hz.

How can I change the limit of x-axis?

The whole code is below,

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
* Copyright (c) 2014 - 2019, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Parents
  • Hi,

    The limit of the x-axis is determined by the FFT_TEST_OUT_SAMPLES_LEN defined, which in your case will be 256, which looks correct. My guess is that the terminal window is too little and that's why the graph is being shifted to the left. Which terminal are you using to output the results? If you are using PuTTY you can modify the size of the terminal window by changing the "Columns" field under the "Window" options.

    Best regards,

    Marjeris

  • Hi msromero!

    Thank you for your care.

    Well, I'm using RTT Viewer now, and when I change the size of the window, Anything changed. :(

    I took some images of several ranges.

    1. 1000hz

    2. 1500hz

    3. 2000hz

    4. 2500hz

    5. 3000hz

    As you can see the image, It is shifted to the left when It reaches over 2000hz.

    And the graph looks symmetrical, is this why it takes up the space?

    Best regards,

    Baek

Reply
  • Hi msromero!

    Thank you for your care.

    Well, I'm using RTT Viewer now, and when I change the size of the window, Anything changed. :(

    I took some images of several ranges.

    1. 1000hz

    2. 1500hz

    3. 2000hz

    4. 2500hz

    5. 3000hz

    As you can see the image, It is shifted to the left when It reaches over 2000hz.

    And the graph looks symmetrical, is this why it takes up the space?

    Best regards,

    Baek

Children
  • Hi Baek,

    I don't mean changing the actual size of the terminal window, but changing how many characters you can fit in the window. But I am not sure how to do this in RTT Viewer. Can you try to test using PuTTY and adjusting the column option I mentioned earlier to see if this is the root of the problem?

    Best regards,

    Marjeris