find the errors in the MATLAB codes
Not what you're looking for?
The program runs, then stops and gives an error of double going into the switch. I changed the code to make it output the sounds, but my whole reasoning was to make this version work with the row vectors.
%taking input phone numbers
Horvector=[1209 1336 1477];
Vervector=[697, 770, 852, 941];
x=input('Enter Phone Number: ','s');
a=0.5;
t=0:1/8192:0.5;
for i=1:length(x)
y=z(i);
switch y
case '1'
z(i)=a*sin(2*pi*Horvector(1)*t) + a*sin(2*pi*Vervector(1)*t);
case '2'
z(i)=a*sin(2*pi*Horvector(2)*t) + a*sin(2*pi*Vervector(1)*t);
case '3'
z(i)=a*sin(2*pi*Horvector(3)*t) + a*sin(2*pi*Vervector(1)*t);
case '4'
z(i)=a*sin(2*pi*Horvector(1)*t) + a*sin(2*pi*Vervector(4)*t);
case '5'
z(i)=a*sin(2*pi*Horvector(2)*t) + a*sin(2*pi*Vervector(2)*t);
case '6'
z(i)=a*sin(2*pi*Horvector(1)*t) + a*sin(2*pi*Vervector(2)*t);
case '7'
z(i)=a*sin(2*pi*Horvector(1)*t) + a*sin(2*pi*Vervector(3)*t);
case '8'
z(i)=a*sin(2*pi*Horvector(2)*t) + a*sin(2*pi*Vervector(3)*t);
case '9'
z(i)=a*sin(2*pi*Horvector(3)*t) + a*sin(2*pi*Vervector(3)*t);
case '*'
z(i)=a*sin(2*pi*Horvector(1)*t) + a*sin(2*pi*Vervector(4)*t);
case '0'
z(i)=a*sin(2*pi*Horvector(2)*t) + a*sin(2*pi*Vervector(4)*t);
case '#'
z(i)=a*sin(2*pi*Horvector(3)*t) + a*sin(2*pi*Vervector(4)*t);
otherwise
disp('Enter a valid number or * or #')
end
end
%to listen to the tones with a 0.25 sec pause between each tone
for i=1:length(x)
sound(z(i));
pause(0.25);
end
Purchase this Solution
Solution Summary
It finds and corrects the errors in the Matlab codes. The response was rated '5/5' by the student who posted the question originally.
Solution Preview
First of all, you have y=z(i); in you attached codes, which should be y=x(i);
Secondly, ...
Purchase this Solution
Free BrainMass Quizzes
Word 2010: Tables
Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.
Javscript Basics
Quiz on basics of javascript programming language.
Inserting and deleting in a linked list
This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.
Basic Networking Questions
This quiz consists of some basic networking questions.
Java loops
This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.