EE 230 HW 2 Solutions Spring 2010

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

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full DocumentRight Arrow Icon
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(
Background image of page 2
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

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

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7
This is the end of the preview. Sign up to access the rest of the document.

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 Right Arrow Icon
Ask a homework question - tutors are online