# Problem with simulation of the desired shape of the signal

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?

• what kind of shape do you want/ do you suspect. What type of signal (audio?) and software do you have. Commented Jan 26, 2016 at 7:24
• Are you measuring or are you creating a signal before measuring Commented Jan 26, 2016 at 8:38
• 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 Commented Jan 26, 2016 at 9:07

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$$
• 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$. Commented Jan 26, 2016 at 11:33