Plot 在Matlab中改变拟合图的线宽

Plot 在Matlab中改变拟合图的线宽,plot,matlab,matlab-figure,Plot,Matlab,Matlab Figure,我想沿以下几行更改拟合图的宽度: plot(fit, 'LineWidth', WidthSpec) 不幸的是,当我尝试绘制数据并同时拟合时,如下所示: plot(fit, 'LineWidth', WidthSpec, XData, YData) 我收到一条错误消息说 ??? Error using ==> cfit.plot at 52 EXCLUDEDATA has greater length than XDATA. 在不指定宽度的情况下打印两个,如 plot(fit, XD

我想沿以下几行更改拟合图的宽度:

plot(fit, 'LineWidth', WidthSpec)
不幸的是,当我尝试绘制数据并同时拟合时,如下所示:

plot(fit, 'LineWidth', WidthSpec, XData, YData)
我收到一条错误消息说

??? Error using ==> cfit.plot at 52
EXCLUDEDATA has greater length than XDATA.
在不指定宽度的情况下打印两个,如

plot(fit, XData, YData) 

工作正常。

尝试存储返回的手柄,并使用该手柄调整宽度:

h = plot(fit, ...);
set(h, 'LineWidth',2)

我也有同样的问题,我使用:

h=曲线图(f);
设置(h,'LineWidth',2)

您是否尝试过
绘图(拟合、扩展数据、YData,'LineWidth',WidthSpec)?这是有问题的函数:那么它应该实际工作:plot(cfit、FitLineSpec、x、y、DataLineSpec)是一个只能指定颜色、标记和线条样式的字符串。例如:
'-.ro'
考虑扩展您的答案,添加与未来读者相关的信息。