Confidence interval of multiple data curves

6 views (last 30 days)
Hello community,
I try to achieve a plot of confidence intervals for several data lines.
Each experiment is represented via separate curves (x,y) like in the sketch below.
To calculate and plot the ci for one curve is very simple:
x = .... % time data;
y = .... % Y data
N = size(y,1); % Number of ‘Experiments’ In Data Set
yMean = mean(y); % Mean Of All Experiments At Each Value Of ‘x’
ySEM = std(y)/sqrt(N); % Compute ‘Standard Error Of The Mean’ Of All Experiments At Each Value Of ‘x’
CI95 = tinv([0.025 0.975], N-1); % Calculate 95% Probability Intervals Of t-Distribution
yCI95 = bsxfun(@times, ySEM, CI95(:)); % Calculate 95% Confidence Intervals Of All Experiments At Each Value Of ‘x’
figure
plot(x, yMean) % Plot Mean Of All Experiments
hold on
plot(x, yCI95+yMean) % Plot 95% Confidence Intervals Of All Experiments
hold off
grid
I'm struggling to adapt the code to multiple data lines.
The data is stored in mat files.
Maybe someone has a clue how to solve this problem
Best regards
Steffen B.

Answers (0)

Products


Release

R2015b

Community Treasure Hunt

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

Start Hunting!