function touchtoneplots(first,last); % TOUCHTONEPLOTS: Show plots of telephone touchtone waves. % % TOUCHTONEPLOTS shows all touchtones (and dialtone). % % TOUCHTONEPLOTS(2,5) shows tones 2 through 5. % Telephone buttons *,0,# correspond to 10,11,12, % and dialtone is 13. % % You can zoom in and out by clicking the graph. % Play the tone through the speaker by clicking the % button to the left of each graph. % Author: % Alexander Russell Perlis % SouthWest Regional Institute in the Mathematical Sciences % c/o Department of Mathematics % The University of Arizona % Tucson, AZ 85721 % (520) 621-2137 % aprl@math.arizona.edu % % Obtain the latest version of this software from: % http://www.math.arizona.edu/~rims/workshops/fourier/softwareMATLAB % % Bugs/problems/ideas: % The tones are loaded each time the user clicks on something. This % slows things down. % % Change history: % May 1997 Original version % Dec 1997 Added support for MATLAB5. matlabVersion=version; matlabVersion=str2num(matlabVersion(1)); if (matlabVersion < 4) | (matlabVersion > 5), disp('Function TOUCHTONEPLOTS is unfamiliar with this version of MATLAB.') return end switch matlabVersion case 4, load tones; case 5, load ptones; end if nargin<1, first=1; end if nargin<2, last=13; end; if strcmp(first,'click'), k=get(gco,'UserData'); if ~isempty(k), switch matlabVersion case 4, sound(tones(1:800,k)); case 5, sound(tones1(1:400,k)); end end return; end count=last-first+1; figure('DefaultAxesYLim',[-1 1],'Visible','off',... 'NumberTitle','off','DefaultAxesFontSize',9,... 'Name','TouchTones (Left: ZoomIn, Right: ZoomOut)'); r=get(0,'ScreenSize'); r = r + [50 50 -100 -100]; set(gcf,'Position',r,'Visible','on'); for k=first:last, subplot(count,1,k-first+1); %% Put number at left r = get(gca,'Position'); r(3) = r(1)/2; r(1) = r(1)/4; uicontrol('Style','pushbutton','String',num2str(k),'Units','normalized',... 'Position',r,'CallBack','touchtoneplots(''click'')','UserData',k); %% Make plot switch matlabVersion case 4, plot(tones(1:800,k)); case 5, plot(tones1(1:400,k)); end end zoom % [eof]