求助:为什么我输入下面的数据拟合代码只出现了一个图。
显示 更早的评论
x=[0 0.01 0.02 0.03 0.04 0.06 0.08 0.10 0.14 0.18];
y=[48 30 20 13 9 5 3 1 1 0];
figure('position',[50 50 1500 400]);
for i=1;3
subplot(1,3,i);
p=polyfit(x,y,i);
xfit=[x(1);0.1;x(end)];
yfit=polyval(p,xfit);
plot(x,y,'ro',xfit,yfit);
set(gca,'fontsize',14);
ylim([0,50]);
legend(4,'data points','fitted curve');
end
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!