%%读取数据
load data
%%创建图形窗口并指定可绘制区域的位置和大小
figure('Position', [100 100 600 475]);
hold on;
%%根据数据绘制曲线
%%拟合曲线
lineFit = line(xdata_fit , ydata_fit );
%%测量曲线误差棒图
Measument = errorbar(xdata_m, ydata_m, ydata_s);
%%验证数据曲线
Data = line(xVdata, yVdata );
%%数据模型曲线1
Model = line(xmodel, ymodel );
%%置信区间曲线1
hCI(1) = line(xmodel, ymodelL);
%%置信区间曲线2
hCI(2) = line(xmodel, ymodelU);
%设置图像标题和横纵坐标轴名称
Title = title ('Graphics title');
XLabel = xlabel('xlabel (unit)');
YLabel = ylabel('ylabel (unit)');
%图表中显示拟合函数关系式
Text = text(5, 800, ...
sprintf('\\it{y = y(x)}'));
%%设置图例特性
hLegend = legend( ...
[Measument, lineFit, Data, Model, hCI(1)], ...
'Data (\mu \pm \sigma)' , ...
'Fit (\it{C x^3+b x^2})' , ...
'Data' , ...
'Model (\it{C x^3})' , ...
'Interval Estimation' , ...
'location', 'NorthWest' );
%%设置字体、字符大小
set( gca , ...
'FontName' , 'Helvetica' );
set([Title, XLabel, YLabel, Text], ...
'FontName' , 'AvantGarde');
set([hLegend, gca] , ...
'FontSize' , 8 );
set([XLabel, YLabel, Text] , ...
'FontSize' , 10 );
set( Title , ...
'FontSize' , 12 , ...
'FontWeight' , 'bold' );
%设置每组曲线的颜色、类型、标记点、线宽等
set(lineFit , ...
'Color' , [0 .5 0] );
set(Measument , ...
'LineStyle' , 'none' , ...
'Marker' , '.' , ...
'Color' , [.5 .5 .5] );
set(Data , ...
'LineStyle' , 'none' , ...
'Marker' , '.' );
set(Model , ...
'LineStyle' , '--' , ...
'Color' , 'r' );
set(hCI(1) , ...
'LineStyle' , '-.' , ...
'Color' , [0 0 0.5] );
set(hCI(2) , ...
'LineStyle' , '-.' , ...
'Color' , [0 0 0.5] );
set(lineFit , ...
'LineWidth' , 2 );
set(Measument , ...
'LineWidth' , 1.5 , ...
'Marker' , 'o' , ...
'MarkerSize' , 6 , ...
'MarkerEdgeColor' , [.3 .3 .3] , ...
'MarkerFaceColor' , [.7 .7 .7] );
set(Data , ...
'Marker' , 'o' , ...
'MarkerSize' , 5 , ...
'MarkerEdgeColor' , 'none' , ...
'MarkerFaceColor' , [.6 .6 1] );
set(Model , ...
'LineWidth' , 2 );
set(hCI(1) , ...
'LineWidth' , 2 );
set(hCI(2) , ...
'LineWidth' , 2 );
%%设置窗口窗格情况
set(gca, ...
'Box' , 'off' , ...
'TickDir' , 'out' , ...
'TickLength' , [.02 .02] , ...
'XMinorTick' , 'on' , ...
'YMinorTick' , 'on' , ...
'YGrid' , 'on' , ...
'XColor' , [.25 .25 .25], ...
'YColor' , [.25 .25 .25], ...
'YTick' , 0:500:2500, ...
'LineWidth' , 1 );