Hi,
I´am doing a weather station using arduino.
I need to calculate ln(x)
How do I write the code to calculate ln(x)?
Best regards
Northriver
Howto calculate ln(x) with arduino?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 54
- Joined: Tue Aug 25, 2009 7:10 am
Re: Howto calculate ln(x) with arduino?
Read the manual:
The AVR math library, which is included in your sketch by using the line
#include <math.h> // (no semicolon)
Includes a great number of useful mathematical functions, including trigonometric, and logarithmic functions.
[...]
Bye
Stefan
The AVR math library, which is included in your sketch by using the line
#include <math.h> // (no semicolon)
Includes a great number of useful mathematical functions, including trigonometric, and logarithmic functions.
[...]
Bye
Stefan
-
- Posts: 3
- Joined: Thu Feb 04, 2010 9:32 am
Re: Howto calculate ln(x) with arduino?
Thanks for reply Stefan,
But I can´t find ln(x) in the math.h library.
only:
double log (double __x)
double log10 (double __x)
Best regards
Northriver
But I can´t find ln(x) in the math.h library.
only:
double log (double __x)
double log10 (double __x)
Best regards
Northriver
bastard wrote:Read the manual:
The AVR math library, which is included in your sketch by using the line
#include <math.h> // (no semicolon)
Includes a great number of useful mathematical functions, including trigonometric, and logarithmic functions.
[...]
Bye
Stefan
- hlantz
- Posts: 115
- Joined: Wed Oct 14, 2009 3:14 pm
Re: Howto calculate ln(x) with arduino?
Isn't that what you're looking for?Northriver wrote:Thanks for reply Stefan,
But I can´t find ln(x) in the math.h library.
only:
double log (double __x)
From the math.h manual page:
double log (double __x) // natural logarithm of x
Natural logarithm of x = ln(x), right?
-
- Posts: 3
- Joined: Thu Feb 04, 2010 9:32 am
Re: Howto calculate ln(x) with arduino?
Thanks again Stefan,
I was trying to calculate the Dew Point
I found the correct formula.
H = (log10(RH)-2.0)/0.4343+(17.62*t)/(243.12+t);
td = 243.12*H/(17.62-H);
RH = Humidity in %
t=temperature in celcius
td= dew point temperature in celsius
Best regards
Northriver
I was trying to calculate the Dew Point
I found the correct formula.
H = (log10(RH)-2.0)/0.4343+(17.62*t)/(243.12+t);
td = 243.12*H/(17.62-H);
RH = Humidity in %
t=temperature in celcius
td= dew point temperature in celsius
Best regards
Northriver
hlantz wrote:Isn't that what you're looking for?Northriver wrote:Thanks for reply Stefan,
But I can´t find ln(x) in the math.h library.
only:
double log (double __x)
From the math.h manual page:
double log (double __x) // natural logarithm of x
Natural logarithm of x = ln(x), right?
Please be positive and constructive with your questions and comments.