CMSIS DSP Software Library: arm_sin_cos_example_f32.c Source File
Main Page
Modules
Data Structures
Files
Examples
File List
Globals
arm_sin_cos_example_f32.c
Go to the documentation of this file.00001 /* ----------------------------------------------------------------------
00002 * Copyright (C) 2010 ARM Limited. All rights reserved.
00003 *
00004 * $Date: 29. November 2010
00005 * $Revision: V1.0.3
00006 *
00007 * Project: CMSIS DSP Library
00008 * Title: arm_sin_cos_example_f32.c
00009 *
00010 * Description: Example code demonstrating sin and cos calculation of input signal.
00011 *
00012 * Target Processor: Cortex-M4/Cortex-M3
00013 *
00014 *
00015 * Version 1.0.3 2010/11/29
00016 * Re-organized the CMSIS folders and updated documentation.
00017 *
00018 * Version 1.0.1 2010/10/05 KK
00019 * Production release and review comments incorporated.
00020 *
00021 * Version 1.0.0 2010/09/20 KK
00022 * Production release and review comments incorporated.
00023 * ------------------------------------------------------------------- */
00024
00068 #include <math.h>
00069 #include "arm_math.h"
00070
00071 /* ----------------------------------------------------------------------
00072 * Defines each of the tests performed
00073 * ------------------------------------------------------------------- */
00074 #define MAX_BLOCKSIZE 32
00075 #define DELTA (0.000001f)
00076
00077
00078 /* ----------------------------------------------------------------------
00079 * Test input data for Floating point sin_cos example for 32-blockSize
00080 * Generated by the MATLAB randn() function
00081 * ------------------------------------------------------------------- */
00082
00083 const float32_t testInput_f32[MAX_BLOCKSIZE] =
00084 {
00085 -1.244916875853235400, -4.793533929171324800, 0.360705030233248850, 0.827929644170887320, -3.299532218312426900, 3.427441903227623800, 3.422401784294607700, -0.108308165334010680,
00086 0.941943896490312180, 0.502609575000365850, -0.537345278736373500, 2.088817392965764500, -1.693168684143455700, 6.283185307179590700, -0.392545884746175080, 0.327893095115825040,
00087 3.070147440456292300, 0.170611405884662230, -0.275275082396073010, -2.395492805446796300, 0.847311163536506600, -3.845517018083148800, 2.055818378415868300, 4.672594161978930800,
00088 -1.990923030266425800, 2.469305197656249500, 3.609002606064021000, -4.586736582331667500, -4.147080139136136300, 1.643756718868359500, -1.150866392366494800, 1.985805026477433800
00089
00090
00091 };
00092
00093 const float32_t testRefOutput_f32 = 1.000000000;
00094
00095 /* ----------------------------------------------------------------------
00096 * Declare Global variables
00097 * ------------------------------------------------------------------- */
00098 uint32_t blockSize = 32;
00099 float32_t testOutput;
00100 float32_t cosOutput;
00101 float32_t sinOutput;
00102 float32_t cosSquareOutput;
00103 float32_t sinSquareOutput;
00104
00105 /* ----------------------------------------------------------------------
00106 * Max magnitude FFT Bin test
00107 * ------------------------------------------------------------------- */
00108
00109 int32_t main(void)
00110 {
00111 arm_status status;
00112 float32_t diff;
00113 uint32_t i;
00114
00115 for(i=0; i< blockSize; i++)
00116 {
00117 cosOutput = arm_cos_f32(testInput_f32[i]);
00118 sinOutput = arm_sin_f32(testInput_f32[i]);
00119
00120 arm_mult_f32(&cosOutput, &cosOutput, &cosSquareOutput, 1);
00121 arm_mult_f32(&sinOutput, &sinOutput, &sinSquareOutput, 1);
00122
00123 arm_add_f32(&cosSquareOutput, &sinSquareOutput, &testOutput, 1);
00124
00125 /* absolute value of difference between ref and test */
00126 diff = fabsf(testRefOutput_f32 - testOutput);
00127
00128 /* Comparison of sin_cos value with reference */
00129 if(diff > DELTA)
00130 {
00131 status = ARM_MATH_TEST_FAILURE;
00132 }
00133
00134 if( status == ARM_MATH_TEST_FAILURE)
00135 {
00136 while(1);
00137 }
00138
00139 }
00140 }
00141
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Generated on Mon Nov 29 2010 17:19:57 for CMSIS DSP Software Library by
1.7.2
Wyszukiwarka
Podobne podstrony:
arm sin cos example ?2?arm linear interp example ?2? sourcearm sin cos example?2? examplearm signal converge example ?2? sourcearm class marks example ?2? sourcearm ?t bin example ?2? sourcearm sin cos ?2? sourcearm sin cos ?2?arm sin cos q31? sourcearm dotproduct example ?2? sourcearm fir example ?2? sourcearm convolution example ?2? sourcearm variance example ?2? sourcearm matrix example ?2? sourcearm iir lattice init ?2? sourcearm sin cos q31?arm biquad ?scade ?1 ?2? sourcearm cmplx mag squared ?2? sourcewięcej podobnych podstron