Ralajer
Active Member
- Joined
- Jul 24, 2008
- Messages
- 416
I am trying to do something similar to this http://www.mrexcel.com/forum/showthread.php?t=352771
but I want the order the polynomial to be variable.
Here is what the code looks like with the static order equal to 2.
Testing the the above static form with my input variables it works as it should.
My attempt to make Array() dynamic
The dimensions appear to be the same for the Array(1,2,...,n) and the powers(1 to n). I've tried transposing the powers variable as well as other configurations and datatypes but I get "Type mis-match" or "Can't assign to array" errors.
A Select Case statement would work as the range is not too large but I would prefer to figure this out.
Thanks
but I want the order the polynomial to be variable.
Here is what the code looks like with the static order equal to 2.
Code:
varDataP = Application.Power(Application.Transpose(arr2), Array(1, 2))
varDataL = Application.LinEst(arr1, Application.Transpose(varDataP))
My attempt to make Array() dynamic
Code:
order = 4 ' for testing
ReDim powers(1 to order)
For i = 1 To order
powers(i) = i
Next
varDataP = Application.Power(Application.Transpose(arr2), powers)
varDataL = Application.LinEst(arr1, Application.Transpose(varDataP))
The dimensions appear to be the same for the Array(1,2,...,n) and the powers(1 to n). I've tried transposing the powers variable as well as other configurations and datatypes but I get "Type mis-match" or "Can't assign to array" errors.
A Select Case statement would work as the range is not too large but I would prefer to figure this out.
Thanks