Received: from PCH.mit.edu (18.7.21.50) by mail.efplus.com (192.168.0.8) with Microsoft SMTP Server (TLS) id 8.3.485.1; Sat, 15 Aug 2020 05:47:33 -0700 Received: from PCH.MIT.EDU (localhost.localdomain [127.0.0.1]) by PCH.mit.edu (8.14.7/8.12.8) with ESMTP id 07FCcEPb030032; Sat, 15 Aug 2020 08:38:52 -0400 Received: from outgoing-exchange-7.mit.edu (OUTGOING-EXCHANGE-7.MIT.EDU [18.9.28.58]) by PCH.mit.edu (8.14.7/8.12.8) with ESMTP id 07FCcEQd030028 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 15 Aug 2020 08:38:14 -0400 Received: from w92exedge4.exchange.mit.edu (W92EXEDGE4.EXCHANGE.MIT.EDU [18.7.73.16]) by outgoing-exchange-7.mit.edu (8.14.7/8.12.4) with ESMTP id 07FCa6PM024336 for ; Sat, 15 Aug 2020 08:36:09 -0400 Received: from oc11expo13.exchange.mit.edu (18.9.4.18) by w92exedge4.exchange.mit.edu (18.7.73.16) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Sat, 15 Aug 2020 08:38:06 -0400 Received: from oc11exhyb8.exchange.mit.edu (18.9.1.113) by oc11expo13.exchange.mit.edu (18.9.4.18) with Microsoft SMTP Server (TLS) id 15.0.1365.1; Sat, 15 Aug 2020 08:38:12 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.176) by oc11exhyb8.exchange.mit.edu (18.9.1.113) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Sat, 15 Aug 2020 08:38:12 -0400 Received: from DM5PR07CA0113.namprd07.prod.outlook.com (2603:10b6:4:ae::42) by BN6PR01MB3284.prod.exchangelabs.com (2603:10b6:404:d9::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.22; Sat, 15 Aug 2020 12:38:11 +0000 Received: from DM3NAM03FT063.eop-NAM03.prod.protection.outlook.com (2603:10b6:4:ae:cafe::39) by DM5PR07CA0113.outlook.office365.com (2603:10b6:4:ae::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.15 via Frontend Transport; Sat, 15 Aug 2020 12:38:11 +0000 Received: from mail-ed1-f46.google.com (209.85.208.46) by DM3NAM03FT063.mail.protection.outlook.com (10.152.83.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Sat, 15 Aug 2020 12:38:11 +0000 Received: by mail-ed1-f46.google.com with SMTP id l23so8774867edv.11 for ; Sat, 15 Aug 2020 05:38:11 -0700 (PDT) From: RussellMc To: Microcontroller discussion list - Public. Sender: "piclist-bounces@mit.edu" Date: Sat, 15 Aug 2020 05:37:30 -0700 Subject: Re: [EE] averaging multiple samples to reject AC interference Thread-Topic: [EE] averaging multiple samples to reject AC interference Thread-Index: AdZzAj+HlkAPDsZTSAmphgxbmqdDvw== Message-ID: References: <20200810131708.06a56fd6300ec2bfca6379d4e10ab8d2.bc322fe198.wbe@email27.godaddy.com> <42b31c06-4e32-b49b-0c18-3a8332eff7fe@myfairpoint.net> <451A1843-D67F-4E8D-A0F1-B7F0F21C1DA8@gmail.com> List-Help: List-Subscribe: , List-Unsubscribe: , In-Reply-To: <451A1843-D67F-4E8D-A0F1-B7F0F21C1DA8@gmail.com> Reply-To: Microcontroller discussion list - Public. Accept-Language: en-US X-MS-Exchange-Organization-AuthAs: Anonymous X-MS-Exchange-Organization-AuthSource: TS500.efplus4.local X-MS-Has-Attach: X-Auto-Response-Suppress: All X-MS-Exchange-Organization-SenderIdResult: Pass X-MS-Exchange-Organization-PRD: mit.edu X-MS-TNEF-Correlator: received-spf: Pass (protection.outlook.com: domain of gmail.com designates 209.85.208.46 as permitted sender) receiver=protection.outlook.com; client-ip=209.85.208.46; helo=mail-ed1-f46.google.com; dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=vZZzZlVS7VSmUrTj1Szc4iTba+f3Ch2MTm6+P2Kfah4=; b=aPqVeI8/cZ/zoFz5xkhmGjzSkZ7QuleeeD44Z02hlEICp8z3PtS2C9Q8nkRCGif0eP 6SetH0Ok5/Xgl1W7weq+stx4DVoZcaM+LGruzjVg0eO3FWEj7JguTUIUyedqTjb1WVIb iguLM+pbrMeQ3PVmU32Y4ljgYrOTKuBlLay59LsqqMQDS3nr8FFTzEDpgO5oH7zBf4u3 /LuLSXjRCI/sSz+00ck37p8XRLWN/XAwUDeJkWrzv6nnZCLm9LfdijvvEcJM5DA2yN9j KjFiruKw2rnIkawNGH22p1mJzVTk356bXEOkeq87Xh0CCSYPXFRJsRV//w+53r68HxN+ Ba4g== authentication-results: spf=pass (sender IP is 209.85.208.46) smtp.mailfrom=gmail.com; mit.edu; dkim=pass (signature was verified) header.d=gmail.com; mit.edu; dmarc=pass action=none header.from=gmail.com; errors-to: piclist-bounces@mit.edu list-id: "Microcontroller discussion list - Public." list-post: x-beenthere: piclist@mit.edu x-mailman-version: 2.1.6 x-received: by 2002:a05:6402:1c09:: with SMTP id ck9mr6919017edb.74.1597495089182; Sat, 15 Aug 2020 05:38:09 -0700 (PDT) x-topics: [EE] x-content-filtered-by: Mailman/MimeDel 2.1.6 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 On Sat, 15 Aug 2020 at 20:56, Isaac Marino Bavaresco < isaacbavaresco@gmail.com> wrote: > Em 14 de agosto de 2020 22:04:36 BRT, RussellMc > escreveu: > > >> Latest/N + Sum x (N-1)/N > > Does N grow indefinitely? > If yes, the new values will have less and less influence as time goes by. > If not, there will be a steady increase in the final result. > Sorry - it didn't occur to me that that was ambiguous. Note that this was an algorithm that I said was not as good as retaining K samples and averaging them. N is a selected factor that controls how much effect the latest sample has compared to all prior samples. Define "AVAL" as the averaged value Initially, set AVAL =3D 1st sample Set N to say 4. This means that from now on new samples will account for 1/4 of the new value of AVAL and the old value will account for 3/4 of the value of AVAL. so AVAL =3D 1/4 x latest sample + 3/4 x AVAL If N was 10 it would be 1/10x sample + 9/10 x AVAL. This is not a marvellous method but has the advantage of not requiring retaining any prior sample values and of the effects of past samples diminishing relatively rapidly. Example: N=3D4 Sequence 5 5 5 5 5 20 20 20 20 20 Output 5 5 5 5 5 8.75 11.6 13.7 15.3 16.5 ... For a single step function AVAL never reached the new value! ______________________________ Better: If you retain say the last 4 and average them with the same input you get 5 5 5 5 5 8.75 12.5 16.25 20 20 ... For a single outlier eg 5 5 5 5 5 20 5 5 5 5 5 5 You'd get 5 5 5 5 5 8.75 8.75 8.75 8.75 5 5 5 ie the outlier has an effect for N samples. R > > --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .