Averaging problem | ThingSpeak API | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Averaging problem
No permission to create posts
November 26, 2017
6:45 am
Avatar
lolkusus
New Member
Members
Forum Posts: 3
Member Since:
November 26, 2017
sp_UserOfflineSmall Offline

Hello,

I stumbled upon a problem.

Every time I average data on my channel it is usually about 2 times smaller

and have a great tendency to have peaks. My raw data has no spikes, or wrong samples.

Field 2, with no average

Field 2, with 60 average

My channel link

It happens on almost all of my fields. If you average on field 1 it looks similar, but is actually 2x smaller than original :/

Can I fix it, or do I need to make a new channel?

November 27, 2017
10:35 am
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 210
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

Some of the fields in your channel  are updated more frequently than others.  When this happens, an empty value is written to the fields that aren't updated, and the average includes the zero values.  The spikes are due to periods when there are relativity fewer nulls than there were recently, and the average jumps.

  I would suggest using a MATLAB analysis to filter your data. The MATLAB analysis will read a value (possibly with thingSpeakRead ) and write it to a new channel (with thingSpeakWrite)if it is not a NULL or zero value.  Then the new channel averaging will work appropriately.  

You can use the REACT App to trigger a MATLAB analysis that filters every time new data is entered.  

Alternatively, you could consider writing each measurement that updates at a different frequency to different channels.  You can use another MATLAB analysis to loop through all the values in your old channel and write them to the new channel without the NULL values.

November 27, 2017
1:50 pm
Avatar
lolkusus
New Member
Members
Forum Posts: 3
Member Since:
November 26, 2017
sp_UserOfflineSmall Offline

 I recently added one field updated by MATLAB analysis which updates at different frequency. I think it might have been a mistake.

Will the problem disappear (in new samples) if I remove this field and let it collect more samples?

All my others fields are updated at once, there were no problems before my messing with MATLAB.

Thank you.

November 27, 2017
3:55 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 210
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

Not a mistake, but an opportunity to improve your chops as a ThingSpeak guru. 🙂  I suggest that you make the output of the MATLAB analysis write to a different channel instead of field 7, then you will still have the analytics you wanted along with the behavior of the averaged ThingSpeak plots that you want.  Once the empty values aren't written to the other fields for as many measurements as you are averaging, the average display will again act as you predicted.  You can export your data on the private view (it will only export what you have it set to show) or using the data export tab on the far right.  From what I saw in your data, only field 7 seemed out of sync with the others.

November 28, 2017
2:04 pm
Avatar
lolkusus
New Member
Members
Forum Posts: 3
Member Since:
November 26, 2017
sp_UserOfflineSmall Offline

After removing field 7 and waiting for more samples, the problem stopped.

Thank you =D

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
18 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 261

Vinod: 196

piajola: 85

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

Newest Members:

celinabw2, FitoSprayscroma, LunnonGor, lancevl16, bernicenk60, veronicadq18

Administrators: Hans: 387, lee: 457