View Full Version : Natural Log (ln) calculation on BS2e

11-23-2006, 09:24 AM
Hi.· I'm working on a senior design project·for Tulane's EECS department, and I've run into a big hangup right in the home stretch.

I'm trying to convert frequency back into voltage by using the PULSIN command.· I've done a very smooth job of creating a very clean, high pulse
that's representative of one full wavelength.· I'm getting steady results for frequency, however I'm having trouble converting it back.

x = frequency
y = voltage

I've come up with an equation, and I know how to handle the negatives and decimal points.· The problem is the natural log.· Is there a trick in PBasic to do ln?·

y = -6.4836Ln(x) + 44.361

Please help!


Tracy Allen
11-23-2006, 02:24 PM
Here's a tutorial on an integer algorithm for lg(x):
www.emesys.com/BS2math3.htm#Logcalc (http://www.emesys.com/BS2math3.htm#Logcalc)
The hard part is always the scaling.

Here's an example using the formula to calculate dewpoint from %RH and temperature, which requires the logarithm of the saturation vapor pressure over water at temperature:
www.emesys.com/programs/dewpoint.bsx (http://www.emesys.com/programs/dewpoint.bsx)

Tracy Allen
www.emesystems.com (http://www.emesystems.com)