MATLAB program simulation of a square wave using harmonic

Status
Not open for further replies.

edirraa

Newbie level 1
Joined
Aug 29, 2009
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,293
square wave matlab

Hi,

Please can you help me, I need to write a few simple programs. I do not have a lot of experience in Matlab and will appreciate your help:

Write a MATLAB program to create a simulation of a square wave using
harmonically related sine waves. The square wave will have a 50% duty cycle and will have negative values i.e. it is a zero mean wave. The Fourier series of a square wave is given by:
S(t) = sin(t) + 1/3 sin(3t) + 1/5 sin(5t) + 1/7 sin (7t) + ……

Your final program should display the square wave starting with only the first
Fourier component and adding additional components after a pause. Add enough components to see the square wave being formed, say 7 components.
Hint: Display the wave over only one period. Repeat this exercise with:
a) A zero mean triangular wave with period 2π.
S(t)= 1- (2/π) sin(πt) – (2/2π) sin( 2πt) – (2/3π) sin(3πt) – (2/4π) sin(4πt) -….

b) Any signal of your choice.
 

generate square wave matlab

see this link to a post in the edaboard.com it has a matlab program as i think will help you
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…