www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/IncludeVariableValueInAxisLabelExample.m

    %% Include Variable Value in Axis Label
% Include a variable value in the _x_-axis label. Use the |num2str|
% function to convert the number to text.

x = linspace(0,10);
amp = 2;
y = amp*cos(x);
plot(x,y)
xlabel(['Sine wave: ' num2str(amp) ' units in amplitude.'])