Code:: Sin Sin Sin Sin Sin

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

5th Harmonics

Code:
V = 1; w = 2*pi*1;
t = 0:0.1:10;
W = 4*V/pi * (((sin (w*t)) + (1/3 * sin (3*w*t)) + (1/5 * sin (5*w*t)) + (1/7 * sin (7*w*t)) + (1/9 * sin
(9*w*t))));
plot (t,W)

Result:

8th Harmonics
Code:
V = 1; w = 2*pi*1;
t = 0:0.1:10;
W = 4*V/pi * (((sin (w*t)) + (1/3 * sin (3*w*t)) + (1/5 * sin (5*w*t)) + (1/7 * sin (7*w*t)) + (1/9 * sin
(9*w*t)) + (1/11 * sin (11*w*t)) + (1/13 * sin (13*w*t)) + (1/15 * sin (15*w*t))));
plot (t,W)

Result:
12th Harmonics
Code:
V = 1; w = 2*pi*1;
t = 0:0.1:10;
W = 4*V/pi * (((sin (w*t)) + (1/3 * sin (3*w*t)) + (1/5 * sin (5*w*t)) + (1/7 * sin (7*w*t)) + (1/9 * sin
(9*w*t)) + (1/11 * sin (11*w*t)) + (1/13 * sin (13*w*t)) + (1/15 * sin (15*w*t)) + (1/17 * sin (17*w*t))
+ (1/19 * sin (19*w*t)) + (1/21 * sin (21*w*t)) + (1/23 * sin (23*w*t))));
plot (t,W)

Result:

15th Harmonics
Code:
V = 1; w = 2*pi*1;
t = 0:0.1:10;
W = 4*V/pi * (((sin (w*t)) + (1/3 * sin (3*w*t)) + (1/5 * sin (5*w*t)) + (1/7 * sin (7*w*t)) + (1/9 * sin
(9*w*t)) + (1/11 * sin (11*w*t)) + (1/13 * sin (13*w*t)) + (1/15 * sin (15*w*t)) + (1/17 * sin (17*w*t))
+ (1/19 * sin (19*w*t)) + (1/21 * sin (21*w*t)) + (1/23 * sin (23*w*t)) + (1/25 * sin (25*w*t)) + (1/27 *
sin (27*w*t)) + (1/29 * sin (29*w*t))));
plot (t, W)

Result:

Conclusion:

Our goal is to prove that the square wave is the summation of all the sinusoids in this activity. In the 5 th
harmonics, the wave looks much more like a sine wave. In the 8 th and 12th harmonics, the sine wave is
starting to look a little like a square wave. In 15 th harmonics, the wave is slowly forming a better square
waveform. I conclude that the more sinusoids we add, the better the square wave pattern we will get.
Or the best if we could add infinite sinusoids for better results.

You might also like