PDA

View Full Version : Adding a signal to a time series




dukebound85
Feb 7, 2012, 04:09 PM
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



chown33
Feb 7, 2012, 06:15 PM
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.

dukebound85
Feb 8, 2012, 12:24 AM
Thanks:) I will attempt to answer these questions

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


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


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

Will do:)


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.


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