How to take 4 variables and do a calculation on them then update to a constant stream of data

1 view (last 30 days)
I have a constant stream of data coming into my program from an arduino. I want to graph the data but I need to create an acceptable variance in order to do that. I have created a user input to tell me their acceptable variance and then I'm stuck on what to do. My psuedocode for what I want to do is this:
% take 4 values of data and sort them into an array
% calculate the standard deviation of those 4 values
% if standard deviation < acceptable variance
% plot
% else
%
% end
I guess my question is, how do I take 4 values from my constant stream of data, do the calculation, plot that, then update the 4 values again...?
Thanks in advance

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!