%Examples for the ELEC241 Matlab tutorial %Chris Rozell - 8/26/03 (crozell@rice.edu) %plot cumulatively summed sine waves with odd integer frequencies %scaled by 1/f t = 0:.001:1; % independent (time) variable A = 1; % amplitude f = 1:2:11; % odd frequencies s = zeros(1,length(t)); % empty 'signal' vector to start with figure % for each frequency, create the signal and add it into s(t) for count=1:6 s = s + A*sin(2*pi*f(count)*t)/f(count); subplot(6,1,count) plot(t,s); ylabel('Amplitude') end subplot(6,1,1) title('Cumulatively summing sine waves') subplot(6,1,6) xlabel('Time (s)')