Averaging problem | ThingSpeak API | Forum

Avatar

Please consider registering
Guest

Search

— Forum Scope —






— Match —





— Forum Options —





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

Register Lost password?
sp_Feed sp_TopicIcon
Averaging problem
Avatar
lolkusus
New Member
Forum Posts: 3
sp_UserOfflineSmall Offline
1
November 26, 2017 - 6:45 am
sp_Permalink sp_Print

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?

Avatar
cstapels

Gold
Forum Posts: 126
sp_UserOfflineSmall Offline
2
November 27, 2017 - 10:35 am
sp_Permalink sp_Print

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.

Avatar
lolkusus
New Member
Forum Posts: 3
sp_UserOfflineSmall Offline
3
November 27, 2017 - 1:50 pm
sp_Permalink sp_Print

 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.

Avatar
cstapels

Gold
Forum Posts: 126
sp_UserOfflineSmall Offline
4
November 27, 2017 - 3:55 pm
sp_Permalink sp_Print

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.

Avatar
lolkusus
New Member
Forum Posts: 3
sp_UserOfflineSmall Offline
5
November 28, 2017 - 2:04 pm
sp_Permalink sp_Print

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: 252

Vinod: 164

cstapels: 96

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:

winnieeq69

AutoCheernpen

Bostermet

engladNed

iivenul

olewaeayafaku

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

 

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Administrators: Hans, lee