Write sinusoidal mathematical equations in MATLAB to play yo
Write sinusoidal mathematical equations in MATLAB to play your favorite song
Solution
Fs = 1000; %# Samples per second
toneFreq = 50; %# Tone frequency, in Hertz
nSeconds = 2; %# Duration of the sound
y = sin(linspace(0, nSeconds*toneFreq*2*pi, round(nSeconds*Fs)));
or
sound(y,FS); %# play sound at sampling rate
or
soundsc(y,Fs);
or
wavread()
sound()
soundsc()
flipud()
wavwrite()
