How to add calculated parameters in to plot title

조회 수: 19 (최근 30일)
Mekala balaji
Mekala balaji 2019년 4월 4일
댓글: Star Strider 2019년 4월 5일
Hi,
I have below example plot, and I want to add more calculated parameters, but it give error.
x_variable=1:1:10;
y_variable=0.1:0.1:1;
mean_ab=mean(x_variable);
max_ab=max(x_variable);
std_ab=std(x_variable);
plot(x_variable,y_variable,'b--o')
title('x_variable:', mean_ab, max_ab, std_ab)
error is below:
Index exceeds matrix dimensions.
Error in titleplot (line 15)
title('x_variable:', mean_ab, max_ab, std_ab)

채택된 답변

Star Strider
Star Strider 2019년 4월 4일
Try this:
title(sprintf('x\\_variable: \\mu = %.2f, max = %.2f, \\sigma = %.2f', mean_ab, max_ab, std_ab))
Experiment to get the result you want.
  댓글 수: 4
Mekala balaji
Mekala balaji 2019년 4월 5일
Thanks,
Star Strider
Star Strider 2019년 4월 5일
As always, my pleasure.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Title에 대해 자세히 알아보기

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by