Find the errors in the matlab codes

Assignment Help MATLAB Programming
Reference no: EM13927436

Find the errors in the MATLAB codes

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

Reference no: EM13927436

Questions Cloud

List of five employers of choice: company image : List of five employers of choice: Company Image, Respected Leadership, Caring of People, Growth and Opportunity, Compensation and Benefits. Using the list of five employers of choice, visit the websites of three companies (choose any three).
Calculate profit for quantity : Calculate profit for each quantity. How much should the firm produce to maximize profit? Calculate marginal revenue and marginal cost for each quantity.
Assess the overall financial health of your organization : What are good and bad signs, if any, in your assessment
Compute dsmns cost of internal equity capital : DSMN's dividend policy is to pay out 50 percent of each year's earnings as dividends. DSMN's marginal tax rate is 40 percent, and its average tax rate is 35 percent. Compute DSMN's cost of internal equity capital.
Find the errors in the matlab codes : 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.
Percentages of industrial robot units assigned : An industrial group reports that there were approximately 122,000 industrial robots operating in a region last year. The graph shows the percentages of industrial robot units assigned to each of six task categories.
What is the total revenue function : The demand curve is given by QD = 500 - 2PX a. What is the total revenue function? b. The marginal revenue function is MR = 250 - Q.
What do you believe is a fair market price for the stock : Under these circumstances, would you purchase this stock? What do you believe is a fair market price for the stock?
Implicit cost for company : 1. Which of the following is most likely to be an implicit cost for Company X? Question 2.The short run is characterized by

Reviews

Write a Review

MATLAB Programming Questions & Answers

  Evaluate the exponential when x is negative

Test your program for x = 10, 2, -2, and -10. From the plots, explain why this is not a good way to evaluate 9 when x

  Programming application that can be written in mat lab

Chose topic in programming application that can be written in Mat Lab code

  Construct the shear force and bending moment diagrams

Write the algorithm and draw the flowchart for each problem

  Write a program to implement this process

A computer cannot store an entire function in its memory. Typically it stores the values of the function at a finite number of points. Pick values of a, b, v, N, and Δt, and write a program to implement this process. Be sure to leave a, b, v, N, an..

  Write a matlab function that generates sentences

Write a MATLAB function that generates sentences of the form (xy)^nz^n , where n is an integer > 0 provided as an argument to your function. This is how the function starts.

  Consider the predator-prey models

Consider the predator-prey models developed early part of the 20 th  century in which the number of predators and preys may be predicted using the pair of ODEs

  Write a script that simulates a casino machine

Write a script that simulates a casino machine. To play a single round on the machine user pays $ 5. Now when the user start the machine, the machine rolls a pair of dice (simulate both dice with help of random number generator) and user only wins..

  Write a matlab script that performs dot product

Let a and b be three-dimensional vectors. Write a MATLAB script that performs: 1. the dot product between the two vectors and 2. the cross product a × b.

  F data into matlab using only the textread function?

load the following type of data into mathlab using ONLY the textread funcion? Need to import it and plot it using boxplot.

  Matlab code to create the global stiffness matrix

Write a MATLAB code to create the global stiffness matrix for a problem with 6 unconstrained degrees of freedom for any linear elastic two dimensional trusses.

  Generalize the program below to allow negative integers

Using SML: Generalize the program below to allow negative integers on the input. We assume that negative integers are preceded by the minus sign(-) rather than the tilde (~). Note that we not only have to recognize negative integers but we can no lon..

  The function take optional arguments, theta, alpha, beta

the function tverskySim (found in problem4/tverskySim.m) takes optional arguments, theta, alpha, beta where theta is the weight assigned to the common features between a and b, alpha is the weight for the distinctive features of a, and beta is the we..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd