View Single Post
  #6   Report Post  
Amedee Van Gasse
 
Posts: n/a
Default

Tushar Mehta shared this with us in microsoft.public.excel.charting:

If you know the period and if phase is not important, then not only
will Solver work but you can get the desired results with just the
LINEST function.


That would be nice!

Since you are only interested in the amplitude, you have a function
of the kind: y=A0+A1*SIN(x).


OK, that sounds correct.

Somewhere you also stated that you believe there is a linear trend in
x. In that case, you would have

y=A0+A1*SIN(x)+A2*x


No, you misread that. I'll just ignore the +A2*x part.

Note that this function is completely amenable to analysis with
LINEST because it is linear in the unknown variables A0, A1, and A2.
And, yes, I tested the results with both LINEST and Solver.

Suppose you have the x values in column A, the SIN(x) values in
column B, and the y values in column C. Then select a 5 rows by 3
columns range and array enter the formula =LINEST(C1:Cn,A1:Bn,TRUE,
TRUE), where n is the last row with data.

You can check the results with Solver. Designate three cells, say
F1, G1, and H1 as the three unknowns, A0, A1, and A2.

In D1 enter the formula =$F$1 + $G$1 * B1 + $H$1 * A1. In E1
calculate =(D1-C1)^2. Copy D1:E1 all the way to rows 2:n. In F3
enter =SUM (E1:En). Ask Solver to minimize F3 by changing F1:H1.
You will get the same results as LINEST.

For my tests, I generated 540 random data points using three
different methods. 3*SIN(x)+(RAND()/5-0.1),
2+3*SIN(x)+(RAND()/5-0.1), and 2+3*SIN(x)+ x/10+(RAND()/5-0.1) I
also tried with the random variable RAND()/2-0.25


Yes!!!
I can work with this. Thank you, thank you, thank you!!!

--
Amedee Van Gasse