// functia ekg furnizeaza valoarea instantanee (intre 0 si 100) a ekg-ului in pozitia px // px ia valori intre 1 si 150 private int ekg(int px) { double x, l, a, b, n, harm, qrs1, qrs2, qrswav; x = px * 0.0045; l = 5; // li=4 a = 1.6; // a_qrswav=1.6 b = (2 * l) / 0.09; // d_qrswav=0.09 n = 100; qrs1 = (a / (2 * b)) * (2 - b); qrs2 = 0.0; for (int i = 1; i < n; i++) { harm = (((2 * b * a) / (i * i * 3.14 * 3.14)) * (1 - Math.Cos((i * 3.14) / b))) * Math.Cos((i * 3.14 * x) / l); qrs2 = qrs2 + harm; } qrswav = 60 * (1 + qrs1 + qrs2); return (System.Convert.ToInt32(qrswav)); }