1

Do I subtract the DC component (mean value) from the amplitude in my sine terms?

$f(t)=\left\{ \begin{array}{l l} 0 & \quad -5\le t\leq 0\\ 1 & \quad 0< t\leq 5 \end{array} \right.$

(I'd write it properly, but it won't let me upload pics of my graph due to low rep, nor use bigger than/smaller than operator... hope you understand!)

Period is $10$.

I see the mean value is $\frac{1}{2}$. that will be a term on it's own. I've aquired the $b_n$ term, but it's twice what the solution in my book says it should be.

I set the amplitude of my function to be $1$ ... should it be $\frac{1}{2}$, because I have to account for the DC component?

DrOnline
  • 127
  • What sort of series are you using, exponential or sin/cos? – copper.hat Apr 28 '13 at 16:25
  • sin and cos. I wasn't even aware there was an alternative, just getting into it. – DrOnline Apr 28 '13 at 16:26
  • I'm getting a bn of 4/(pin), but the solution says 2/(pin), which leads me to think I need to reduce the amplitude by 1/2 due to the DC component. Can't seem to find any concrete explanation for it. – DrOnline Apr 28 '13 at 16:28
  • @DrOnline why should you? Nope, you don't. Just proceed with the definitions of $a_0$, $a_n$,$b_n$. Can you post the formula for them that you use? Usually there is a mess with coefficients before the integral. – Caran-d'Ache Apr 28 '13 at 16:29

1 Answers1

1

Form the definition of $a_n$: $$a_n = \frac{1}{\pi}\int_{-\pi}^\pi f(x) \cos(nx)\, dx, \quad n \ge 0$$ or For signals it is easier to use period of the signal ($2\pi=T$): $$a_n = \frac{2}{T}\int_{-\frac{T}{2}}^{\frac{T}{2}} f(x) \cos\left(\frac{2 \pi n x}{T}\right)\, dx, \quad n \ge 0$$ May be you loose the factor $2$ before the integral? Sometimes in some textbooks the answer is given as $\frac{a_n}{2}=\ldots, \quad \frac{b_n}{2}=\ldots$. $$b_n = \frac{2}{T}\int_{-\frac{T}{2}}^{\frac{T}{2}} f(t) \sin\left(\frac{2 \pi n t}{T}\right)\, dt=\frac{2}{T}\int_{-\frac{T}{2}}^{0} f(t) \sin\left(\frac{2 \pi n t}{T}\right)\, dt+\frac{2}{T}\int_{0}^{\frac{T}{2}} f(t) \sin\left(\frac{2 \pi n t}{T}\right)\, dt=\frac{2}{T}\int_{-\frac{T}{2}}^{0} 0 \ \sin\left(\frac{2 \pi n t}{T}\right)\, dt+\frac{2}{T}\int_{0}^{\frac{T}{2}} 1\ \sin\left(\frac{2 \pi n t}{T}\right)\, dt$$

$$b_n=\frac{2}{T}\int_{0}^{\frac{T}{2}} 1\ \sin\left(\frac{2 \pi n t}{T}\right)\, dt=\frac{2}{T}\frac{1}{\frac{2 \pi n}{T}}\left(-\cos\left(\frac{2 \pi n t}{T}\right)\right)\bigg|_0^\frac{T}{2}=\frac{1}{\pi n}\left(1-\cos\left(\pi n\right)\right)$$

Caran-d'Ache
  • 3,564
  • How do you produce these formulas so quickly? How are you entering the tags? Some software? I'd love to know! – DrOnline Apr 28 '13 at 16:35
  • bn=4T∫T2−0(x)sin(2pin*t/T)dx,n≥0 – DrOnline Apr 28 '13 at 16:36
  • @DrOnline Just got used. :) Did the answer help? – Caran-d'Ache Apr 28 '13 at 16:37
  • I double the amplitude, and half the period, because the off function is equal on both sides of y. – DrOnline Apr 28 '13 at 16:37
  • When I integrate, the sine terms becomes -cos, and sloughs off T/(2pin), T = 10, so 5/(2pin), I move the - away from the cos expression and get a bn of -(2/(pin)(cos(pi*n)-1) – DrOnline Apr 28 '13 at 16:39
  • To answer your specific question about whehter it helped, your formula is just like the one I am using. – DrOnline Apr 28 '13 at 16:40
  • $$b_n = \frac{4}{T}\int_{0}^{\frac{T}{2}} f(x) \cos\left(\frac{2 \pi n x}$$ – DrOnline Apr 28 '13 at 16:42
  • @DrOnline You can just see this and verify that the solution that you obtained for $b_n$ is correct, but as I understand you are asked not about $b_n$ but $\frac{b_n}{2}$. – Caran-d'Ache Apr 28 '13 at 16:44
  • Man, I'm really trying to write out the formulas, but it's just not working, I even copied what you wrote in your post using the edit, changed out the 2/T coefficient to the integral with 4/T, and changed the integral limits from -T/2 T/2 to 0 T/2, and it won't display. – DrOnline Apr 28 '13 at 16:48
  • Hold on, going to post links to pictures of my work, since I have too low rep to upload them. – DrOnline Apr 28 '13 at 16:50
  • My formula from lecture: http://i.imgur.com/jmPxnHL.jpg – DrOnline Apr 28 '13 at 16:54
  • My work: http://i.imgur.com/QNXCwUs.jpg – DrOnline Apr 28 '13 at 16:54
  • The problem is - my sin amplitudes are twice what they should be, according to the text book. 2/pi, 2/(3pi) etc.. I have 4/pi, 4/(3pi) etc. – DrOnline Apr 28 '13 at 16:55
  • @DrOnline What for did you double the integral in the third line? $ \frac{2}{T}\int_{-\frac{T}{2}}^{\frac{T}{2}} f(t) \cos\left(\frac{2 \pi n t}{T}\right), dt=\frac{2}{T}\int_{-\frac{T}{2}}^{0} 0 \ \cos\left(\frac{2 \pi n t}{T}\right), dt+\frac{2}{T}\int_{0}^{\frac{T}{2}} 1 \ \cos\left(\frac{2 \pi n t}{T}\right), dt$. So shouldn't it be $\frac{2}{T}\int_{0}^{\frac{T}{2}} \cos\left(\frac{2 \pi n t}{T}\right), dt$ – Caran-d'Ache Apr 28 '13 at 17:15
  • I doubled it at the end of the 2nd line, because the area of an even function, a function that is mirrored by the y axis, is doubled. The area of a cosine from -T/2 to T/2 is twice the area from 0 to T/2. But.. perhaps that is not the case in this task, because of the DC component.. – DrOnline Apr 28 '13 at 17:20
  • hmm.. I see your formula. I am doing the task again now without doubling like that, and using the -T/2 to T/2 range. Thank you so far! :D – DrOnline Apr 28 '13 at 17:24
  • Now I am having a problem with getting -1/(pin)(cos(pin)-cos(-pin)), and the cos terms of course always cancel each other out, giving 0.. hmm – DrOnline Apr 28 '13 at 17:31
  • wait.. I made a mistake here.. I set the amplitude to 1 for the whole period, that makes no sense, the amplitude is 0 for t -5 to 0.. – DrOnline Apr 28 '13 at 17:33
  • Got it now. My mistake from the beginning was that I was using logic which applies, in terms of mirroring along the y axis, only if you are dealing with, say, a cosine wave. Where it is equal on the left and the right side of the y-axis. It also applies if the square wave is +A on the right, and -A on the left, for example. However, THIS signal is 0 on the left and 1 on the right, not mirrored. So I cannot simply double it. I get the right answer now. Thank you so much for all your help! – DrOnline Apr 28 '13 at 17:36
  • @DrOnline see little update. – Caran-d'Ache Apr 28 '13 at 17:39
  • Thank you, that exactly what I am getting! Thanks a lot :D – DrOnline Apr 28 '13 at 17:52
  • @DrOnline An upvote is not necessary but is appreciate :). It shows that the answer was helpful to the OP. – Caran-d'Ache Apr 28 '13 at 18:24
  • "Vote up requires 15 reputation", I tried many times, I always upvote on "Stack Overflow", the programming forum"... – DrOnline Apr 28 '13 at 19:29
  • I'm bookmarking this for an actual upvote when I get the necessary reputation! ;) – DrOnline Apr 28 '13 at 23:31