![]() ![]() don't forget to convert constants to float ģ. turn on optimization for specific routines By default, expand will expand the power 2 and simplify the sin input 3x to x. 7) Similarly, you can plot a sine wave by simply changing the cosine to the sine function. 6) Enter plot function (plot (x-axis variable ,y- axis variable)) & click RUN. 5) Enter Cosine wave equation (acos (2ft)) with all the set variables. Expand only terms raised to powers and suppress expansion of functions by using 'ArithmeticOnly'. To multiply trigonometric functions, another option is the Wikipedia article covering the List of Trigonometric Identities. 4) Set the amplitude & frequency of the signal. check that your MCU application actually uses the FPU By default, expand both expands terms raised to powers and expands functions by applying identities that simplify inputs to the functions. Just for comparison, I achieved a runtime of 2.5ms to 4.0ms for a 2048-point FFT, using the CMSIS DSP lib code. Because these numbers are not symbolic objects, sin returns floating-point results. Compute the sine function for these numbers. ![]() ![]() Examples Sine Function for Numeric and Symbolic Arguments Depending on its arguments, sin returns floating-point or exact symbolic results. Not so familiar with Keil, but I believe it has extensive code profiling support.īut I suspect your runtime issue is rather with code organization than with the math code itself. Trig Functions Like Excel, and most other programming environments, trig functions in MATLAB work with radians. Description example sin (X) returns the sine function of X. Sine & Cosine Function, Computes both the sine and cosine of x, where x is in radians. You can measure the runtime of certain code (functions) either with the support of the toolchain (so-called 'profiling'), or add GPIO toggles before/after the code and measure with a scope. Inverse Cotangent Function, Computes the inverse cotangent of x. Trigonometric Ratios Trigonometric Ratios for Unit Circle Trigonometry Identities Even and Odd Angle Formulas Co-function Formulas Double Angle Formulas. Not sure if this has to do with the math/trigonometric code alone. For complex values of X, tan (X) returns complex values. For real values of X, tan (X) returns real values in the interval. The function accepts both real and complex inputs. The tan function operates element-wise on arrays. With my shallow knowledge of Matlab, I would suggest to start by modifying model to use single-precision instead of double. Y tan (X) returns the tangent of each element of X. You would not need to write any of this 'emulation code' yourself, the appropriate 'libm.a' version would do that for you.ĭon't know about Matlab/Simulink. The statement would apply if you used a Cortex M0 or Cortex M3. Fp operation must be emulated' do you mean by using look-up table as example for the ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |