求助:为什么我输入下面的数据拟合代码只出现了一个图。
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Legend en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!