How to add calculated parameters in to plot title

16 次查看(过去 30 天)
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 个评论

请先登录,再进行评论。

更多回答(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