MATLAB Lecture 8 School of Mathematical Sciences Xiamen Univer http://gdjpkc.xmu.edu.cn A curve fitting example(曲线拟合) > High boy=[155,1.58,1.6,1.64,1.66,1.68,1.7,1.73,1.78,1.8,1.82,1.85 >> Weight boy={60,57,57,65,63,64,70,65,68,76,72,78 > plot( High boy, Weight boy, 'b* >> hold on >Everage boy=polyfit( High boy, Weight boy, 1) >>X1,5: 0.1: 1.9, boy line=Everage boy(1)x+ Everage boy (2) plot(x, boy line, ' g-,linewidth, 1.2); 旧囟 File Edit View Insert Tools Desktop Window Help 3 D日舀心Q回日国 Appendix Various line types, plot symbols and colors may be obtained with PLoT(X,Y, S)where S is a character string made from one element from any or all the following 3 columns point X-mark dashdot magenta star (none)no line diamond triangle(up) triangle(left) triangle(right) pentagram You can use a subset of TeX commands embedded in the string to produce special characters such as Greek letters and mathematical symbols. The following table lists these characters and the character sequences used to define them Lec8-I0MATLAB Lecture 8 School of Mathematical Sciences Xiamen University http://gdjpkc.xmu.edu.cn Lec810 A curve fitting example (曲线拟合) >> High_boy=[1.55, 1.58, 1.6, 1.64, 1.66, 1.68, 1.7, 1.73, 1.78, 1.8, 1.82, 1.85]; >> Weight_boy=[60, 57, 57, 65, 63, 64, 70, 65, 68, 76, 72, 78]; >> plot(High_boy, Weight_boy, 'b*') >> hold on; >> Everage_boy=polyfit(High_boy, Weight_boy, 1) >> x=1.5:0.1:1.9; boy_line=Everage_boy(1)* x + Everage_boy(2) >> plot(x, boy_line, 'g', 'linewidth', 1.2); ² Appendix Various line types, plot symbols and colors may be obtained with PLOT(X,Y,S) where S is a character string made from one element from any or all the following 3 columns: b blue . point solid g green o circle : dotted r red x xmark . dashdot c cyan + plus dashed m magenta * star (none) no line y yellow s square k black d diamond v triangle(down) ^ triangle (up) < triangle(left) > triangle(right) p pentagram h hexagram You can use a subset of TeX commands embedded in the string to produce special characters such as Greek letters and mathematical symbols. The following table lists these characters and the character sequences used to define them