Matlab function (M-File) that will create & play a sinusoidal waveform

  1. I am trying to create a matlab function (M-File) that will create & play a sinusoidal waveform with the given amplitude (A), frequency (f), sampling rate (Fs), and time span (tspan). the function must produce a .wav file with a specified filename.

    the matlab Function Format must be:

    function mytone(A,f,Fs,tspan,filename)

    I have a sample problem:
    the command mytone(0.4,300,8000,3,'threehundred.wav') creates and plays a sinusoid x(t)=0.4sin(2*pi*300t) for 3 secs. the sampling rate is 8000 Hz. the resulting tone is saved with a filename threehundred.wav.

    after executing the command, you must hear a low frequency tone similar to the dial tone of telephone.


    I am really a newbie in using MATLAB. I hope somebody can help me.
     
  2. jcsd
Know someone interested in this topic? Share a link to this question via email, Google+, Twitter, or Facebook