I have an 18 point data set that I need to obtain a cos expression trend line for in the form of
f(x)= a + b cos(x + c)
where a, b, c are variables
There must be software that can attempt this can excell do? I can't play until the morning.
I have got pretty close with an expression of the form
f(x)= (a + cos(x + c))/b
we have to test its fit validity using an R^2 test, unfortunately my equation just fails on this criteria.
Any ideas chaps
I don't think excel can do this kind of fitting, but I don't think you actually need a trend line to what you need to do.
I think 'a' should just be the amount that the sine/cos wave is shifted up or down from oscillating around zero, 'b' should be the
amplitude of the sine/cos wave (ie the amount it moved up and down from 'a', and 'c' relates to the phase of the wave ie where it
reaches it's peak in relation to 0 on the x axis.
It sounds like you already have an equation that is pretty close, you should just be able to rejog the numbers you already have to get it in the right
form
HTH!
Incidentally excel does have a useful feature called 'solver' (it's in the analysis toolpack that you enable using the
'add-ins' menu option)
It allows you to specify a cell (like your r^2 value) that it should try to minimise/maximize etc and it can play with the inputs to an equation until
it finds an answer that meets your criteria.
I don't think you'll need it here but it can be quite useful.
quote:
f(x)= a + b cos(x + c)
thanks fellas, that eaxactly how i fitted my wave. by altering the phase angle and amplitutde.
been looking at it again this morning and we are not sure its possible within our constraints of r^2. We will keep trying
Many Thanks for the advice guys
If you're doing that kind of thing regularly then you want something like matlab. Quite a learning curve but the right tool for the job if you
use it a lot.
http://www.mathworks.com/
There is an open source project (kind of project that should work well as university bods will be interested)
http://www.gnu.org/software/octave/
i reckon i have a copy of matlab floating round from wehn i did the math degree