3:30 pm

August 24, 2015

Hi,

Would it be possible to add error bars to the data in a chart?

I'd like to be able to plot the mean value of some sample data +/- one standard deviation on each point represented by an error bar... something like this for example:

http://3.bp.blogspot.com/-aiPECwSj0VE/Uep8hsQ0qtI/AAAAAAAABN0/Iwv5Sv9OJ1I/s1600/error_bars_both.png

Thanks!

7:59 am

MathWorks

August 22, 2015

Yes -- you can using the MATLAB errorbar plot.

I'll try to post an example later, but here's the documentation:

http://www.mathworks.com/help/matlab/ref/errorbar.html

-Rob

Senior Development Manager for IoT and Hardware Interfacing for MATLAB at MathWorks. Visit ThingSpeak.com to explore the IoT Analytic platform that speaks MATLAB made for engineers and scientists. You can collect, analyze, and act in 5 minutes or less!

3:54 pm

August 24, 2015

Hi again,

Is it possible to create an error bar plot using MATLAB Visualizations? I can't see an option using thingsSpeakPlot.

If I try to use MATLAB Analysis and the errorbar(x,y,e) function I get an error that states..

"Cannot use MATLAB visualization code "bar(x,y,e)" in the MATLAB Analysis app. You must create a MATLAB Visualization."

5:40 pm

MathWorks

August 25, 2015

That is correct, you can create an error bar plot using MATLAB Visualizations App. You will not be able to create an error bar plot in a MATLAB Analysis App.

Create a new MATLAB Visualization App and select "Custom (no starter code)" option from the Templates. Paste the below MATLAB Code in the new MATLAB Visualizations App to generate an example "errorbar" plot.

x = 0:pi/10:pi;

y = sin(x);

e = std(y)*ones(size(x));

errorbar(x,y,e)

7:53 pm

MathWorks

August 22, 2015

Hi,

I have an arduino that is contantly writing to ThinkSpeak to monitor the system intake performance. Here's some code that I use to visualize the data associated with that. You should be able to copy/paste this into a MATLAB Visualization verbatim.

numHours = 6;

[data,ts] = thingSpeakRead(52622,'readkey','P3DEWWFW89DVMUIY','NumMinutes',numHours*60,'Fields',1);

% Create hour of day categories to summarize by

hourOfDay = floor(hours(timeofday(ts)));

% Apply the function max, min, mean, and standard deviation to each of the

% hours in the day

sumStats = table;

sumStats.hour = unique(hourOfDay);

sumStats.max = arrayfun(@(x)(max(data(hourOfDay == x))),sumStats.hour);

sumStats.min = arrayfun(@(x)(min(data(hourOfDay == x))),sumStats.hour);

sumStats.mean = arrayfun(@(x)(mean(data(hourOfDay == x))),sumStats.hour);

sumStats.std = arrayfun(@(x)(std(data(hourOfDay == x))),sumStats.hour);

errorbar(sumStats.hour, sumStats.mean,sumStats.std,'d-')

hold on

plot(sumStats.hour, sumStats.max ,'+',...

sumStats.hour, sumStats.min ,'+')

hold off

Senior Development Manager for IoT and Hardware Interfacing for MATLAB at MathWorks. Visit ThingSpeak.com to explore the IoT Analytic platform that speaks MATLAB made for engineers and scientists. You can collect, analyze, and act in 5 minutes or less!

2:43 pm

August 24, 2015

Thanks Rob - that's got it all working well now 🙂 Thank you!

Thanks also Adash - makes sense now 🙂

Cheers!

Mean CO2 with Errors:

https://thingspeak.com/channels/51602

9:24 pm

MathWorks

August 22, 2015

Looks awesome! Thanks for sharing!

-Rob

Senior Development Manager for IoT and Hardware Interfacing for MATLAB at MathWorks. Visit ThingSpeak.com to explore the IoT Analytic platform that speaks MATLAB made for engineers and scientists. You can collect, analyze, and act in 5 minutes or less!

Most Users Ever Online: 114

Currently Online:

17 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, veronicadq18Administrators: Hans: 387, lee: 457