|
灰袍法师 发表于 2014-9-5 17:35
Range("B3").GoalSeek Goal:=Range("B18").Value, ChangingCell:=Range("C16")
===============
这样就可 ...
呵呵,我自己写了【单变量求解】的代码:- Function fuc(x, y, z, k, l, t)
- a = 2E-22 * t ^ 6 - 3E-18 * t ^ 5 + 0.00000000000002 * t ^ 4 - 0.00000000005 * t ^ 3 + 0.00000006 * t ^ 2 - 0.000005 * t + 0.311
- b = -1E-20 * t ^ 6 + 7E-17 * t ^ 5 - 0.0000000000002 * t ^ 4 + 0.0000000003 * t ^ 3 - 0.0000003 * t ^ 2 + 0.0003 * t + 0.3844
- c = 3E-20 * t ^ 6 - 2E-16 * t ^ 5 + 0.0000000000004 * t ^ 4 - 0.0000000004 * t ^ 3 + 0.0000002 * t ^ 2 - 0.000009 * t + 0.3584
- d = 2E-20 * t ^ 6 - 9E-17 * t ^ 5 + 0.0000000000002 * t ^ 4 - 0.0000000002 * t ^ 3 + 0.0000001 * t ^ 2 + 0.00002 * t + 0.312
- e = -5E-20 * t ^ 6 + 1E-16 * t ^ 5 - 0.00000000000005 * t ^ 4 - 0.00000000007 * t ^ 3 - 0.00000003 * t ^ 2 + 0.0002 * t + 0.414
- fuc = (a * x + b * y + c * z + d * k + e * l) * t * 4.182
- End Function
- Sub myGoalSeek()
- x = [c6]: y = [c8]: z = [c10]: k = [c12]: l = [c14]: s = [c16]
- t0 = 0
- For m = 0 To 10
- t = t0 + 10 ^ m
- r = fuc(x, y, z, k, l, t)
- If r > s Then Exit For
- Next
- t = 10 ^ (m - 1) + 10 ^ (m - 15)
-
- For i = 1 To m
- For n = 1 To 9
- Mid(t, i, 1) = n
- r = fuc(x, y, z, k, l, t)
- If r > s Then Exit For
- Next
- Mid(t, i, 1) = n - 1
- Next
-
- For i = m + 2 To 16
- For n = 1 To 9
- Mid(t, i, 1) = n
- r = fuc(x, y, z, k, l, t)
- If r > s Then Exit For
- Next
- Mid(t, i, 1) = n - 1
- Next
-
- [c18] = t
- MsgBox t
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|