arm_nuttall4a_f64.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* ----------------------------------------------------------------------
  2. * Project: CMSIS DSP Library
  3. * Title: arm_nuttall4a_f64.c
  4. * Description: Floating-point (f64) Nuttall4a window
  5. *
  6. * $Date: 14 December 2022
  7. * $Revision: v1.15.0
  8. *
  9. * Target Processor: Cortex-M and Cortex-A cores
  10. * -------------------------------------------------------------------- */
  11. /*
  12. * Copyright (C) 2010-2022 ARM Limited or its affiliates. All rights reserved.
  13. *
  14. * SPDX-License-Identifier: Apache-2.0
  15. *
  16. * Licensed under the Apache License, Version 2.0 (the License); you may
  17. * not use this file except in compliance with the License.
  18. * You may obtain a copy of the License at
  19. *
  20. * www.apache.org/licenses/LICENSE-2.0
  21. *
  22. * Unless required by applicable law or agreed to in writing, software
  23. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  24. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  25. * See the License for the specific language governing permissions and
  26. * limitations under the License.
  27. */
  28. #include "dsp/window_functions.h"
  29. #include "dsp/fast_math_functions.h"
  30. #include <math.h>
  31. /**
  32. @ingroup groupWindow
  33. */
  34. /**
  35. @addtogroup WindowNormal
  36. @{
  37. */
  38. /**
  39. @ingroup WindowNUTTALL4A
  40. */
  41. /**
  42. @brief Nuttall4a window generating function (f64).
  43. @param[out] pDst points to the output generated window
  44. @param[in] blockSize number of samples in the window
  45. @par Parameters of the window
  46. | Parameter | Value |
  47. | ------------------------------------: | -----------------: |
  48. | Peak sidelobe level | 82.6 dB |
  49. | Normalized equivalent noise bandwidth | 2.1253 bins |
  50. | 3 dB bandwidth | 2.0123 bins |
  51. | Flatness | -0.7321 dB |
  52. | Recommended overlap | 68.0 % |
  53. */
  54. void arm_nuttall4a_f64(
  55. float64_t * pDst,
  56. uint32_t blockSize)
  57. {
  58. float64_t k = 2. / ((float64_t) blockSize);
  59. float64_t w;
  60. for(uint32_t i=0;i<blockSize;i++)
  61. {
  62. w = PI_F64 * i * k;
  63. w = 0.338946 - 0.481973 * cos (w) +
  64. 0.161054 * cos (2 * w) - 0.018027 * cos (3 * w);
  65. pDst[i] = w;
  66. }
  67. }
  68. /**
  69. @} end of WindowNormal group
  70. */