Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 7, 2012, 04:09 PM   #1
dukebound85
macrumors P6
 
dukebound85's Avatar
 
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.
dukebound85 is offline   0 Reply With Quote
Old 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.
chown33 is offline   0 Reply With Quote
Old Feb 8, 2012, 12:24 AM   #3
dukebound85
Thread Starter
macrumors P6
 
dukebound85's Avatar
 
Join Date: Jul 2005
Location: 5045 feet above sea level
Thanks I will attempt to answer these questions

Quote:
Originally Posted by chown33 View Post
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
dukebound85 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Wi-Fi time-out while full signal. I-Han MacBook Pro 2 Feb 18, 2013 08:08 AM
iPhone: Wifi and data signal lost time to time elisa2012 Jailbreaks and iOS Hacks 8 Dec 16, 2012 09:52 PM
Trouble adding new MacBook to existing Time Machine (Time Capsule) Cowboy59 Mac Peripherals 1 Oct 14, 2012 06:20 AM
Adding a Series of Images to Numbers danqi Mac Applications and Mac App Store 2 Sep 2, 2012 09:18 AM
Lexmark 3300 series won't scan from Time Capsule Diogones Mac Peripherals 1 Aug 15, 2012 07:35 AM

Forum Jump

All times are GMT -5. The time now is 03:05 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC