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

by makovx
Tags: matlab, sinusoid, wavefile
makovx is offline
Nov30-09, 05:09 AM
P: 24
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.
Phys.Org News Partner Science news on
Better thermal-imaging lens from waste sulfur
Hackathon team's GoogolPlex gives Siri extra powers
Bright points in Sun's atmosphere mark patterns deep in its interior

Register to reply

Related Discussions
using a batch file to create NAMELIST input file for FORTRAN Programming & Computer Science 0
Metal Heat Treatment: How to create a sinusoidal function that increases in frequency Introductory Physics Homework 0
Sinusoidal waveform issue Engineering, Comp Sci, & Technology Homework 1
Deriving RMS value from sinusoidal waveform. Calculus & Beyond Homework 19
MATLAB: Using WavWrite to Create a Single Audio File Math & Science Software 3