EE 230 HW 2 Solutions Spring 2010

# EE 230 HW 2 Solutions Spring 2010 - EE 230 HW2 Solutions...

This preview shows pages 1–7. Sign up to view the full content.

EE 230 HW2 Solutions Problem 1 1. A square wave can be represented a sum of an infinite number of sine waves as follows: 1 sin 2 2 1 4 21 square k ft k x k a. When K=1 , we obtain the fundamental b. When K=2,….,7 , we obtain the 2 nd ,3 rd , …. .,7 th harmonics respectively c. Sum up the 1 st 7 harmonics Matlab code for problem 1: clear all close all f=1000; % frequency t=-1e-3:1e-5:1e-3; % time x_out=0; for i=1:1000 x = (4/pi)*sin((2*i-1)*2*pi*f.*t)/(2*i-1); % One harmonic at a time

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
x_out = x_out + x; % Add up the harmonics if i==1 plot(t*1e3,x, 'b' , 'linewidth' ,2.5), xlabel( 'time(ms)' , 'fontsize' ,14),ylabel( 'Voltage(V)' , 'fontsize' ,14) hold on end if i==2 plot(t*1e3,x, 'g' , 'linewidth' ,2.5), xlabel( 'time(ms)' , 'fontsize' ,14),ylabel( 'Voltage(V)' , 'fontsize' ,14) hold on end if i==3 plot(t*1e3,x, 'c' , 'linewidth' ,2.5), xlabel( 'time(ms)' , 'fontsize' ,14),ylabel( 'Voltage(V)' , 'fontsize' ,14) hold on end if i==4 plot(t*1e3,x, 'k' , 'linewidth' ,2.5), xlabel( 'time(ms)' , 'fontsize' ,14),ylabel( 'Voltage(V)' , 'fontsize' ,14) hold on end if i==5 plot(t*1e3,x, 'm' , 'linewidth' ,2.5), xlabel( 'time(ms)' , 'fontsize' ,14),ylabel( 'Voltage(V)' , 'fontsize' ,14) hold on end if i==6 plot(t*1e3,x, 'y' , 'linewidth' ,2.5), xlabel( 'time(ms)' , 'fontsize' ,14),ylabel(

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 02/01/2012 for the course EE 230 taught by Professor Mina during the Fall '08 term at Iowa State.

### Page1 / 7

EE 230 HW 2 Solutions Spring 2010 - EE 230 HW2 Solutions...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online