I am trying to generate a signal with specific frequency and shape. I have accomplished to get a time domain signal with the specified frequency, however the shape does not match. Is there any method to get the desired shape. Will phase be any helpful?
-
$\begingroup$ what kind of shape do you want/ do you suspect. What type of signal (audio?) and software do you have. $\endgroup$– Jan-BertCommented Jan 26, 2016 at 7:24
-
$\begingroup$ Are you measuring or are you creating a signal before measuring $\endgroup$– Jan-BertCommented Jan 26, 2016 at 8:38
-
$\begingroup$ I am trying to simulate a signal. I want it to have a specific shape (ex: square) and also to have some specified freq( ex: 1 hz and 2 hz). I have got a signal of the specified freq but the shape is not square. I am using MATLAB $\endgroup$– Jyothi JainCommented Jan 26, 2016 at 9:07
1 Answer
For a square wave as used in your example phase don't do anything. Since the fourrier series is just based on a sine wave without phase. The fourrier series are: $$ S_n (x) = \frac{a_0}{2}+ \sum_{n=1}^{N} A_n \cdot \sin (\frac{2 \pi \cdot n \cdot x}{P}) \qquad \text{for integer } N \geq 1 $$
Since the square wave have only the odd frequencies. you can choose for the sinewaves: 1, 3, 5, 7, 9, 11, 13 ,...
For other functions it is different. In that case you have both sine and cosine signals. Combination of both give as result the phase. if you have an series of 7 or 8 frequencies it is allready close to a square wave.
-
2$\begingroup$ Whether the Fourier series only has sine or cosine (or both) components only depends on the signal being an odd or an even function or neither of the two (plus possibly a constant). So you can easily have a square wave with only cosine components or with sine and cosine components, depending on where you define the point $t=0$. For this reason it's a bit misleading to believe that 'a square wave' only has sine components as its Fourier series. That is just a consequence of how you defined it w.r.t. the point $t=0$. $\endgroup$– Matt L.Commented Jan 26, 2016 at 11:33