RTOS_MSPM0  1.1
ECE445M starter code
Data Structures | Macros | Typedefs | Functions | Variables
Math

Data Structures

struct  complex
 a complex number has a real and imaginary part More...
 

Macros

#define PI   3.14159265358979323846264338327950288
 PI is ratio of circumference to diameter of a circle.
 

Typedefs

typedef struct complex complex_t
 

Functions

void fft (complex_t *v, int n, complex_t *tmp)
 fft More...
 
void ifft (complex_t *v, int n, complex_t *tmp)
 Inverse fft. More...
 
int16_t fixed_sin (int32_t theta)
 decimal fixed-point sin More...
 
int16_t fixed_cos (int32_t theta)
 decimal fixed-point cos More...
 
int32_t fixed_sin2 (int32_t theta)
 binary fixed-point sin More...
 
int32_t fixed_cos2 (int32_t theta)
 binary fixed-point cos More...
 
int32_t sin540 (int32_t theta)
 binary fixed-point sin More...
 
int32_t cos540 (int32_t theta)
 binary fixed-point cos More...
 

Variables

float Real
 
float Imag
 

Detailed Description

Function Documentation

◆ cos540()

int32_t cos540 ( int32_t  theta)

binary fixed-point cos

binaryfixed-point cos****************

Parameters
theta0 to 539, angle is in units 2*pi/540 = 0.011635528 radians (0 to 2pi)
Returns
-65536 to +65536, fixed point resolution 1/65536
Note
input theta=4096 means 90 degrees (pi/2 radians)

◆ fft()

void fft ( complex_t v,
int  n,
complex_t tmp 
)

fft

discrete Fast Fourier Transform, Converts time to frequency domain
Assume the input is real data sampled at fs
Place n measurements into the real part of array v
Set the imaginary part of array v to 0
Call fft() and the results are returned back in array v
If the input is real only, then the transform will contain
Index 0 <= k < n/2 complex components of frequency f=k/fs
E.g., k=0 represents the DC component of the input
Index n/2 <= k < n are complex conjugates of the first half

Parameters
varray of input data in complex form
nsize of the two arrays 2, 4, 8, ..., 2048
tmptemporary array of data in complex form
Returns
none
Note
n is a power of two from 2 to 2048

◆ fixed_cos()

int16_t fixed_cos ( int32_t  theta)

decimal fixed-point cos

decimal fixed-point cos****************

Parameters
theta-3142 to 3142, angle is in units radians/1000
Returns
-10000 to +10000, fixed point resolution 1/10000
Note
input theta=-1571 means 90 degrees (pi/2 radians)

◆ fixed_cos2()

int32_t fixed_cos2 ( int32_t  theta)

binary fixed-point cos

binaryfixed-point cos****************

Parameters
theta-8192 to 8191, angle is in units 2*pi/16384 radians (-pi to +pi)
Returns
-65536 to +65536, fixed point resolution 1/65536
Note
input theta=4096 means 90 degrees (pi/2 radians)

◆ fixed_sin()

int16_t fixed_sin ( int32_t  theta)

decimal fixed-point sin

decimal fixed-point sin****************

Parameters
theta-3142 to 3142, angle is in units radians/1000
Returns
-10000 to +10000, fixed point resolution 1/10000
Note
input theta=1571 means 90 degrees (pi/2 radians)

◆ fixed_sin2()

int32_t fixed_sin2 ( int32_t  theta)

binary fixed-point sin

binary fixed-point sin****************

Parameters
theta-8192 to 8191, angle is in units 2*pi/16384 radians (-pi to +pi)
Returns
-65536 to +65536, fixed point resolution 1/65536
Note
input theta=-4096 means -90 degrees (pi/2 radians)

◆ ifft()

void ifft ( complex_t v,
int  n,
complex_t tmp 
)

Inverse fft.

discrete Inverse Fast Fourier Transform, Converts frequency to time domain
Assume the input is complex data with components k=0 to n-1
Index 0 <= k < n-1 complex components of frequency f=k/fs
E.g., k=0 represents the DC component of the input
Place n complex values into the array v
Typically the index n/2 <= k < n are complex conjugates of the first half
Call ifft() and the results are returned back in array v
If the input is real only, then the transform will contain

Parameters
varray of input data in complex form
nsize of the two arrays 2, 4, 8, ..., 2048
tmptemporary array of data in complex form
Returns
none
Note
n is a power of two from 2 to 2048

◆ sin540()

int32_t sin540 ( int32_t  theta)

binary fixed-point sin

binary fixed-point sin****************
e.g., 359.3degrees (2pi radians) theta=539 sin540(539) = -763 (-0.0116)
e.g., 270 degrees (3pi/4 radians) theta=405 sin540(405) = -65536 (-1)
e.g., 180 degrees (pi radians) theta=270 sin540(270) = 0 (0)
e.g., 90 degrees (pi/2 radians) theta=135 sin540(135) = 65536 (+1)
e.g., 45 degrees (pi/4 radians) theta= 67 sin540(67) = 46071 (sqrt(2)/2)
e.g., 0 degrees (0 radians) theta= 0 sin540(0) = 0 (0)

Parameters
theta0 to 539, angle is in units 2*pi/540 = 0.011635528 radians (0 to 2pi)
Returns
-65536 to +65536, fixed point resolution 1/65536