所以这是我的情况:
我有大量数据,x 值为 1-18,但 y 值会有所不同。其中一些是空白,因为等式是 /0 - 排列成行。
我正在尝试获取每行 y 值的多项式趋势线的 m^3、m^2、m、c 系数.. y1、y2 等。
因为我不能将 Linest() 与空白一起使用,所以我尝试使用 VBA 复制所有相关(非空白)的 y 值,但也删除了该行的关联 x 值。
这是数据的示例部分 - 但还有更多行
x 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 m3 m2 m c
y1 0.0 1.0 2.0 2.0 1.0 0.0 1.0 - 2.0 2.0 1.0 2.0 2.5 1.0 1.0 2.0 1.0 4.0 ? ? ? ?
y2 0.0 1.0 - 2.0 2.0 0.0 2.0 2.0 0.0 1.7 4.0 1.0 2.0 2.0 4.0 1.0 3.0 2.0 ? ? ? ?
到目前为止,我一直在尝试但没有取得多大成功。
到目前为止,我一直在尝试这样的事情,但没有成功,但这是我第一次尝试 VBA .. 如果我不知道显而易见的事情,很抱歉!
'code to identify known_y and known_x ranges
For each testvalue in known_y
If testvalue indicates that this point should be included in regression
then copy this data point (both known_y and known_x value for this point) either into an array (if I want to invoke LINEST() from within VBA) or into another range in the spreadsheet.
Next testvalue
Invoke LINEST() using the copied data
如果有人可以提供帮助,将不胜感激!!