View Single Post
NobodyInPerson's Avatar
Posts: 52 | Thanked: 63 times | Joined on Sep 2014 @ Germany
#5
I ran a fourrier transformation on the battery data to extract the typical time period of one battery cycle. Without looking at the data I would say my battery lasts one day on average. Charging over night, using over the day, and so on. Funnily, the fourrier analysis gives me exactly this result

Code:
R> source('NokiaN9-battery-period.R')
Period: 24.02245 hours
Here the code I used:

NokiaN9-battery-period.R:

Code:
# How long is battery life on the Nokia N9?
# Find the period of charge of battery

# Read CSV file
BAT <- read.csv("NokiaN9-batterydata-5months.csv", sep = "\t")

# Interpolate on regular grid
APPROX <- approx(BAT$TIME, BAT$BATTERY,xout = seq(f = min(BAT$TIME), t = max(BAT$TIME), len = length(BAT$TIME)))

# Get spectrum
SPECTRUM <- spectrum(APPROX$y,plot=F)

# Find maximum period
# First find frequency of greatest amplitude
# Invert this frequency to get the period
# Multiply this period that is in units of timesteps with the timestep to get the period in seconds
PERIOD <- 1/SPECTRUM$freq[which.max(SPECTRUM$spec)] * unique(zapsmall(diff(APPROX$x)))

# Output period in hours
cat("Period:", PERIOD / 60 / 60,"hours")

Last edited by NobodyInPerson; 2017-01-14 at 08:18.
 

The Following 4 Users Say Thank You to NobodyInPerson For This Useful Post: