VBA: Calculating Complex Numbers
First of all I'd like to say I appreciate this site and all who
participate. You are very helpful, very skilled, and very unique
individuals.
I need to call on you once again with a trigonometry problem. I need
code to sum the sine and cosine (in degrees) of a product of a variable
range.
IE
In Easy Language code it looks like this:
(Compute Dominant Cycle Phase)
DCPeriod= IntPortion(Value1)
RealPart=0;
ImagPart=0;
For Count= 0 to DCPeriod-1 begin
RealPart= RealPart + Sine(360*count/DCPeriod)*(Cycle[Count]);
ImagPart= ImagPart+ Cosine(360*count/DCPeriod)*(Cycle[Count]);
End;
The Cycle data is located in Col (I) and begins in row 7
The Value1 data is in Col (P) and begins in row 12.
I would like to be able to have the results for RealPart and Imagpart
in the next Col (Q &R) respectively. Below is sample data:
(I) (P) (Q) (R)
Cycle Value1 RealPart ImagPart
0.0
..02
-.05
-.124
-.191
-.231 .3 Result Result
-.251 1.1 Result Result
..064 4.5
..014 10.8
..028 10.3
-.049 12.5
-.07 13.4
-.135 11.3
-.203 12.3
-.283 13.2
..036 14.6
..053 27.2
..085 28.4 Etc Etc
Perhaps this can be calculated as a function?
If you need any more info, I'll be glad to clarify.
Thank You again,
Len S
|