首页 > 解决方案 > 如何在 IDL 中对图表上的数据点进行曲线拟合?

问题描述

我正在寻找使用 IDL 曲线拟合图表上的一些数据点。我目前有以下图表

黑色背景上的六个 ASCII 数据图

我能够使用命令 robust_linefit 在图 3 上获得一条最佳拟合线,但我无法使用命令 curvefit 在需要曲线拟合而不是直线的图形上绘制曲线。

当我尝试曲线拟合时,我无法定义命令所需的函数,因为它只是随机数据,我无法为整个数据计算函数。

与我一起工作的教授告诉我有关平滑命令的信息,但我无法在 harrisgeospatial 网站上找到任何与绘图特别相关的命令。有一些选项可以取数据的平均值,但我不知道如何使用这些命令来拟合我的图表。

如果不是太麻烦,有人可以解释如何绘制曲线拟合。

编辑:

我忘了像现在一样发布包含绘图命令的代码。

!p.multi = [0,2,4]
Window, 0, xsize = 1250, ysize = 1250
plot, x, y, ytitle='Temperature (C)', xtitle = 'time', $
title='Temperature variation on May 31st, 2021', xrange = [0,      24], psym=1

plot, x, z, ytitle = 'Humidity (%)', xtitle = 'time', $
title = 'Humidity variation over 24 hours on May 31st, 2021',       xrange = [0,24], psym =1

plot, x, b, ytitle = 'Wind direction', xtitle = 'time', $
title = 'Wind direction and pressure over 24 hours on May 31st, 2021', xrange = [0,24], psym = 1
;linefit the graph
coeff = robust_linefit(x,b, sfit)
oplot, x, sfit, color = 1

plot, x, c, ytitle = 'Solar irradiance (W/m^2)', xtitle = 'time', $
title = 'Solar irradiance variation over 24 hours on May 31st, 2021', xrange = [0,24], psym = 1

plot, x, d, ytitle = 'Wind Speed (m/s)', xtitle = 'Time',$
title = 'Wind Speeds over 24 hours on May 31st, 2021', xrange = [0,24], psym = 1

plot, x, e, ytitle = 'Battery Voltage (V)', xtitle = 'Time', $
title = 'Battery Voltage variation over 24 hours on May 31st, 2021', xrange = [0,24], yrange = [13.2,14], psym = 1

plot, x, a, ytitle = 'Pressure (kPa)', xtitle = 'Time', $
title = 'Atmospheric Pressure variation over 24 hours on May 31st, 2021', xrange = [0, 24], yrange = [102,102.75], psym = 1

标签: graphcurve-fittingidl

解决方案


推荐阅读