Revision as of 16:30, 5 September 2008 by Eblount (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

%Emily Blount %Homework 1 %September 4, 2008 %ECE 301, Mimi Boutin

%clear memory and console clear; clc;

%Part a: Playing Twinkle Twinkle Little Star (since I don't know Hail Purdue.)

% Note Frequencies C = 261.626; D = 9*C/8; E = 5*C/4; F = 4*C/3; G = 3*C/2; A = 5*C/3; B = 15*C/8; Chi = 2*C;

%Array of Notes for Song S = [C, C, G, G, A, A, G, F, F, E, E, D, D, C];

%Time definition and Sampling Frequency delta = 0.00005; endtime = 0.5; t = 0:delta:endtime;

%Playing the song for x = 1:1:length(S)

   song = sin(2*pi * t * S(x));
   sound(song, 1/delta);

end

pause(5)

%Part b: Playing the song 2x faster delta = 0.00005; endtime = .25; t = 0:delta:endtime;

%Playing the song for x = 1:1:length(S)

   song = sin(2*pi * t * S(x));
   sound(song, 1/delta);

end

pause(5)

%Part c: Rescaling song to y(t)=x(2t) delta = 0.00005; endtime = 0.5; t = 0:delta:endtime;

%Playing the song for x = 1:1:length(S)

   song = sin(2*pi * 2* t * S(x));
   sound(song, 1/delta);

end

Alumni Liaison

Questions/answers with a recent ECE grad

Ryne Rayburn