Mean and Std in Subplot Graphs
조회 수: 2 (최근 30일)
이전 댓글 표시
How can i add mean and Std horizontal lines to all plots?? (eg.ym1 and ys1 are mean and std of subplot subplot(3, 2, 1))
figure
subplot(3, 2, 1)
ym1=mean(distlocus1)
ys1=std(distlocus1)
plot(distlocus1)
title('Início - 15''')
subplot(3, 2, 2)
ym2=mean(distlocus2)
ys2=std(distlocus2)
plot(distlocus2)
title('15'' - 30''')
subplot(3, 2, 3)
ym3=mean(distlocus3)
ys3=std(distlocus3)
plot(distlocus3)
title('30'' - Intervalo''')
subplot(3, 2, 4)
ym4=mean(distlocus4)
ys4=std(distlocus4)
plot(distlocus4)
title('Intervalo'' - 60''')
subplot(3, 2, 5)
ym5=mean(distlocus5)
ys5=std(distlocus5)
plot(distlocus5)
title('60'' - 75''')
subplot(3, 2, 6)
ym6=mean(distlocus6)
ys6=std(distlocus6)
plot(distlocus6*ym6)
title('75'' - Final''')
댓글 수: 0
답변 (1개)
Star Strider
2017년 9월 17일
편집: Star Strider
2017년 9월 17일
I would plot them as:
plot(xlim, [1 1]*ym1, '-r', xlim, ym1+[1 -1; 1 -1]*ys1, '-g')
and so for the others.
This plots the mean in red, and the the two standard deviation lines in green. This uses xlim, so it will automatically span the x-axis limits.
댓글 수: 2
Star Strider
2017년 9월 17일
I was thinking of something like this:
subplot(3, 2, 1)
ym1=mean(distlocus1)
ys1=std(distlocus1)
plot(distlocus1)
hold on
plot(xlim, [1 1]*ym1, '-r', xlim, ym1+[1 -1; 1 -1]*ys1, '-g')
hold off
title('Início - 15''')
So add the hold calls, and the new plot call, to plot the mean and standard deviation. This applies to all the subplots, so all you need to do is to change ‘ym1’ and ‘ys1’ in the other subplots to their appropriate variables.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
