上周写《抛射体运动的照相法研究》的实验报告时,需要绘制图像,然而恰好电脑上没有Origin(EA家的Origin倒是有一个(╯‵□′)╯︵┻━┻),于是便使用Mathematica进行了表差法处理(只是一个循环而已……然而感觉好不习惯)和图像的绘制……
以绘制y-t图像为例……
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
(* y的数据,单位为cm *) m = {0.9, 6.0, 9.2, 11.1, 11.2, 9.6, 6.3, 1.5, -5}; (* 数据拟合 *) fitting = LinearModelFit[m, {1, t, t^2}, t]; (* 拟合结果 *) line = fitting["BestFit"] (* 绘制图形 *) Show[Plot[line, {t, 0, 9.1}], ListPlot[m, PlotStyle -> Red, PlotMarkers -> {"+", 20}, AxesOrigin -> {0}], LabelStyle -> {Bold}, Frame -> True, FrameLabel -> {Style[t, 15, Bold, Blue], Style[y, 15, Bold, Blue]}, ImageSize -> 500] (* 误差分析 *) fitting[{"RSquared", "FitResiduals", "ANOVATable"}] |
Origin在我这边总是运行几分钟以后crash….每次都不得不用MATLAB作图=。=