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

Currently Online:

29 Guest(s)

Currently Browsing this Page:

1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

porosh2019, KellyBrise, sunainakhanna, flail, sathwik, samlewis02Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457