第十八题--插值
![Mathematica入门习题[18]–插值](https://img.mathpretty.com/snipaste_20170912_164734.png?imageView2/0/q/75|watermark/2/text/5YWz5rOo5YWs5LyX5Y-377ya5paH6Im65pWw5a2m5ZCb/font/5b6u6L2v6ZuF6buR/fontsize/540/fill/IzAwMDAwMA==/dissolve/100/gravity/SouthEast/dx/10/dy/10|imageslim)
Clear["Global`*"]
time = Table[i, {i, 6, 18, 2}] ;
tempIn = {18, 20, 22, 25, 30, 28, 24};
tempOut = {15, 19, 24, 28, 34, 32, 30};
fIn = Interpolation[Transpose[{time, tempIn}], Method -> "Spline"];
fOut = Interpolation[Transpose[{time, tempOut}], Method -> "Spline"];
Plot[fIn[x], {x, 6, 18.5}, PlotLabel -> Style["室内温度", Bold, 20]]~Show~
ListPlot[Table[{x, fIn[x]}, {x, 6.5, 18.5, 2}],
PlotStyle -> {Hue[.3], PointSize[.03]}]
Plot[fOut[x], {x, 6, 18.5},
PlotLabel -> Style["室外温度", Bold, 20]]~Show~
ListPlot[Table[{x, fOut[x]}, {x, 6.5, 18.5, 2}],
PlotStyle -> {Hue[.3], PointSize[.03]}]
![Mathematica入门习题[18]–插值](https://img.mathpretty.com/snipaste_20170912_205223.png?imageView2/0/q/75|watermark/2/text/5YWz5rOo5YWs5LyX5Y-377ya5paH6Im65pWw5a2m5ZCb/font/5b6u6L2v6ZuF6buR/fontsize/540/fill/IzAwMDAwMA==/dissolve/100/gravity/SouthEast/dx/10/dy/10|imageslim)
评论