cancel
Showing results for 
Search instead for 
Did you mean: 

How to work with radians?

DK.7
Senior

How to work with radians in HAL?

I include a math library

#include "math.h"

and trying to implement a formula which has radians

cleansignal = 3.0 * sin (radians (Count));

And CubeIDE gives me an error: undefined reference to` radians'

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Math functions take radians as an input value. If your value is in degrees, you will need to convert it.

Assuming "Count" is in degrees:

cleansignal = 3.0 * sin (Count * 3.14159f / 180);

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

1 REPLY 1
TDK
Guru

Math functions take radians as an input value. If your value is in degrees, you will need to convert it.

Assuming "Count" is in degrees:

cleansignal = 3.0 * sin (Count * 3.14159f / 180);

If you feel a post has answered your question, please click "Accept as Solution".