Matlab 6 - tone=sin(2*pi*480*t sin(2*pi*620*t%tone=[tone...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
function [number,duration]=inputkey() duration=input( 'enters value between 50 and 1000mes:' ); number =input( 'enter a tel:' ); %for 1=1:max(size(number)) %if number(1)<0 ||number(1)>9 %y=error('invalid input'); %handle=input('would you like to continue without improper charaters?'); %end %if handle==y %number(1)=''; %else %error('invalid characters inout for telephone number'); %end end close all clear all clc [number,duration]=inputkey(); signals( 'dial' ) for i=1:length(number) keys=keypad(number(i),duration); soundssc(keys,10000) pause(0.5) end signals( 'ring' ) %x=rand; %if x>0.5 %signals('busy') %else %signal('ring') %end function signals(tone) switch tone case ( 'dial' ) t=0:0.0001:2; tone=sin(2*pi*350.*t)+sin(2*pi*440.*t); case ( 'busy' )
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
t=[0:0.0001:5,ones(1,5000)];
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: tone=sin(2*pi*480.*t)+sin(2*pi*620.*t); %tone=[tone tone tone tone tone tone tone tone]; case ( 'ring' ); t=[0:0.0001:2,zeros(1,40000)]; tone=sin(2*pi*440.*t)+sin(2*pi*480.*t); tone=[tone tone tone tone]; end soundsc(tone,10000) function wave=keypad(number,duration) switch (number) case 1 f=[697,1209]; case 2 f=[697,1336]; case 3 f=[697,1477]; case 4 f=[770,1209]; case 5 f=[770,1336]; case 6 f=[770,1477]; case 7 f=[852,1209]; case 8 f=[852,1336]; case 9 f=[852,1477]; case '*' f=[941,1209]; case f=[941,1336]; case '#' f=[941,1477]; end t=0:0.0001:duration/1000; wave = (sin(2*pi*f(1).*t))+(sin(2*pi*f(2).*t)); plot(t,wave) end...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern