MacRumors Forums Adding a signal to a time series

 Feb 7, 2012, 04:09 PM #1 dukebound85 macrumors P6     Join Date: Jul 2005 Location: 5045 feet above sea level Adding a signal to a time series How would one go about adding a signal (such as a sin wave) to a time series? For instance, I would like a period to occur every time step Thanks Last edited by dukebound85; Feb 7, 2012 at 04:17 PM. 0
 Feb 7, 2012, 06:15 PM #2 chown33 macrumors 603   Join Date: Aug 2009 If there's one period of the sine wave at every time step, then the contribution from the sine wave is constant. The value of the constant depends on the phase of the sine wave relative to your time sample. If the above isn't clear, draw it on some graph paper. Assume each vertical line on the graph paper is a sample point. Draw a sine wave whose period is identical to the vertical lines of the graph paper (one cycle per space between vertical lines). What is the value of the sine wave at each vertical line? If the vertical lines represent the samples of your time series, then what is the sine wave's value at each sample point? If you change the phase of the sine wave with respect to the vertical lines (sample points), but keep the sine's period at 1 cycle per sample interval, what changes? For example, if the phase is 1/4-waveform (90 degrees), what changes at each sample point? For reference, look up "Nyquist frequency" and "Shannon sampling theorem", and see what "aliasing" means as a DSP term. If you want to add a sine wave whose period is less than your sampling frequency, then use the sin() function to calculate it based on the ratio of your sine frequency to your sampling frequency. Example: for a sine wave of 100 Hz, and a sampling frequency of 1 Khz, you have 10 sample points per sine period. Since sin() is circular, that means 2pi = 10 sine-wave samples. The equations aren't that hard to work out if you apply basic algebra. I think it's worthwhile to know how to develop the equations, because it will give you a better sense of how signals are related to sampled data. Last edited by chown33; Feb 7, 2012 at 06:21 PM. 0
Feb 8, 2012, 12:24 AM   #3
dukebound85
macrumors P6

Join Date: Jul 2005
Location: 5045 feet above sea level
Thanks I will attempt to answer these questions

Quote:
 Originally Posted by chown33 If there's one period of the sine wave at every time step, then the contribution from the sine wave is constant. The value of the constant depends on the phase of the sine wave relative to your time sample. If the above isn't clear, draw it on some graph paper. Assume each vertical line on the graph paper is a sample point. Draw a sine wave whose period is identical to the vertical lines of the graph paper (one cycle per space between vertical lines). What is the value of the sine wave at each vertical line? If the vertical lines represent the samples of your time series, then what is the sine wave's value at each sample point?
This would be the value of the initial time series at whatever sampling frequency

Quote:
 If you change the phase of the sine wave with respect to the vertical lines (sample points), but keep the sine's period at 1 cycle per sample interval, what changes? For example, if the phase is 1/4-waveform (90 degrees), what changes at each sample point?
If the frequency would shift, then the value of the series would be the inital time series plus the amplitude of the sine wave at that corresponding shift

Quote:
 For reference, look up "Nyquist frequency" and "Shannon sampling theorem", and see what "aliasing" means as a DSP term.
Will do

Quote:
 If you want to add a sine wave whose period is less than your sampling frequency, then use the sin() function to calculate it based on the ratio of your sine frequency to your sampling frequency. Example: for a sine wave of 100 Hz, and a sampling frequency of 1 Khz, you have 10 sample points per sine period. Since sin() is circular, that means 2pi = 10 sine-wave samples.
So if my sampling period in my initial time series is 1 per day, but want to add in a sin wave that has a period that completes in say 3 days, the frequency would be (1/3)? I will be looking more into this but it has been a while.

Quote:
 The equations aren't that hard to work out if you apply basic algebra. I think it's worthwhile to know how to develop the equations, because it will give you a better sense of how signals are related to sampled data.
I agree. Thanks for the pointers
0

 MacRumors Forums