这个拟合的曲线,为什么第一条好第二条在图例中是一样.。
14 views (last 30 days)
Show older comments
这个拟合的曲线,为什么第一条好第二条在图例中是一样的呢?
d=[500 1000 1500 2000 2500];
t1=[0.299 0.566 0.841 1.117 1.393];
d.^2;
t1.^2;
scatter(d.^2,t1.^2)
hold on
p1=polyfit(d.^2,t1.^2,1);
f1=polyval(p1,d.^2);
plot(d.^2,t1.^2,'r-*')
t2=[0.364 0.517 0.701 0.897 1.099];
t2.^2;
scatter(d.^2,t2.^2)
p2=polyfit(d.^2,t2.^2,1);
f2=polyval(p2,d.^2);
plot(d.^2,f2,'b-s')
t3=[0.592 0.638 0.708 0.799 0.896];
t3.^2;
scatter(d.^2,t3.^2,[0.25 0.25 0.25])
p3=polyfit(d.^2,t3.^2,1);
f3=polyval(p3,d.^2);
plot(d.^2,t3.^2,'g-d')
legend('第一条','第二条','第三条',2)
0 Comments
Accepted Answer
rimomov
on 25 Nov 2022
d=[500 1000 1500 2000 2500];
t1=[0.299 0.566 0.841 1.117 1.393];
d.^2;
t1.^2;
scatter(d.^2,t1.^2,'ro')
hold on
p1=polyfit(d.^2,t1.^2,1);
f1=polyval(p1,d.^2);
plot(d.^2,t1.^2,'r-*')
t2=[0.364 0.517 0.701 0.897 1.099];
t2.^2;
scatter(d.^2,t2.^2,'+')
p2=polyfit(d.^2,t2.^2,1);
f2=polyval(p2,d.^2);
plot(d.^2,f2,'b-s')
t3=[0.592 0.638 0.708 0.799 0.896];
t3.^2;
scatter(d.^2,t3.^2,'gv')
p3=polyfit(d.^2,t3.^2,1);
f3=polyval(p3,d.^2);
plot(d.^2,t3.^2,'g-^')
legend('第一条 (data)','第一条 (fit)','第二条 (data)','第二条 (fit)','第三条 (data)','第三条 (fit)',2)
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!