So I this code, basically applying simple mathematical arithmetic to variables. rrdistance, qsdistance, heartrate give desirable values, while pamp and qamp don't. I think it rounds up? Supposedly, at i = 1, the values of trial[1] is 120, Pycoor[1] is 102, and Qycoor[1] is 134. FINALBOXWIDTH(bitmap_Source) is 10.
So the expected results of pamp = ((120-102)/10) * 0.1 = 0.18 while qamp = ((134-120)/10) * 0.1 = 0.14
I don't understand why they both display pamp = 0.1 and qamp = 0.1.
static int[] Pxcoor = new int[50];
static int[] Pycoor = new int[50];
static int[] Qxcoor = new int[50];
static int[] Qycoor = new int[50];
static int[] Rxcoor = new int[50];
static int[] Rycoor = new int[50];
static int[] Sxcoor = new int[50];
static int[] Sycoor = new int[50];
static int[] Txcoor = new int[50];
static int[] Tycoor = new int[50];
static int[] trial = new int[450];
public static int FINALBOXWIDTH(Bitmap src) { ...
}
private void StratBackgroundProcess() {
if (i >= 2) {
rrdistance += (((Rxcoor[i] - Rxcoor[i - 1]) / FINALBOXWIDTH(bitmap_Source)) * 0.04);
//durations in seconds
printerval += (((Rxcoor[i] - Pxcoor[i]) / FINALBOXWIDTH(bitmap_Source)) * 0.04);
qsdistance += (((Sxcoor[i] - Qxcoor[i]) / FINALBOXWIDTH(bitmap_Source)) * 0.04);
heartrate += (1500 / (rrdistance / 0.04));
//amplitude in mV
pamp = (( (trial[1] - Pycoor[i]) / FINALBOXWIDTH(bitmap_Source)) * 0.1);
qamp = (( (Qycoor[i] - trial[i]) / FINALBOXWIDTH(bitmap_Source)) *0.1);
}
}
Pamp = pamp; Qamp = qamp;
coordinate.setText("" + pamp + "," + qamp + " ");