Mathematica入门习题[18]–插值

  • A+

 

第十八题--插值

 

 

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]}]

 

 

 

  • 微信公众号
  • 关注微信公众号
  • weinxin
  • QQ群
  • 我们的QQ群号
  • weinxin
王 茂南

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: