Josué Polanco
2008-Aug-01 10:34 UTC
[R] Solving Yis[i] = a*cos((2*pi/T)*(times[i] - Tau)) + ...
Hi everybody, I am reading the Lomb paper (Lomb, 1976) and I found an interesting equation, and I wish to resolve it using R. I am wondering if anybody has a hint. The equation is: Yis[i] = a*cos((2*pi/T)*(Times[i] - Tau)) + b*sin((2*pi/T)*(Times[i] - Tau)) ... (1) Where T and Tau are constants. I know the "Times" and "Tis" values (in fact these values come from a Time Series), and I need found the values of a and b. I can resolve the eq. (1) using a pencil and paper (expanding this as a linear system of equation), it is not a difficult problem, although I am not able to resolve it using R. Any hint or advice would be very appreciated, Thank you so much -- Josue Polanco [[alternative HTML version deleted]]
Hans W. Borchers
2008-Aug-01 13:43 UTC
[R] Solving Yis[i] = a*cos((2*pi/T)*(times[i] - Tau)) + ...
Treat it as an over-determined linear system, that is:
A <- cbind(cos((2*pi/T)*(Times - Tau)), sin((2*pi/T)*(Times - Tau)))
qr.solve(A, Yis)
because 'solve' will only handle square matrices.
----
Hans W. Borchers
Josu? Polanco wrote:>
> Hi everybody,
>
> I am reading the Lomb paper (Lomb, 1976) and I found an interesting
> equation, and I wish to resolve it using R. I am wondering if anybody has
> a
> hint. The equation is:
>
> Yis[i] = a*cos((2*pi/T)*(Times[i] - Tau)) + b*sin((2*pi/T)*(Times[i] -
> Tau)) ... (1)
>
> Where T and Tau are constants. I know the "Times" and
"Tis" values (in
> fact
> these values come from a Time Series), and I need found the values of a
> and
> b. I can resolve the eq. (1) using a pencil and paper (expanding this as a
> linear system of equation), it is not a difficult problem, although I am
> not
> able to resolve it using R.
>
> Any hint or advice would be very appreciated,
>
> Thank you so much
>
> --
> Josue Polanco
>
>
--
View this message in context:
http://www.nabble.com/Solving-Yis-i--%3D-a*cos%28%282*pi-T%29*%28times-i----Tau%29%29-%2B-...-tp18771850p18774613.html
Sent from the R help mailing list archive at Nabble.com.