1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

  1. Nov 30, 2009 #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
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted