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

  Create a function called freefall

Write a function called eapprox that takes the value of K as input and which them approximates e using the method described.

  Matlab m-script that will generate a damped sinusoid

1.) Write a MATLAB m-script that will generate a damped sinusoid (frequency = 440 Hz) with a time constant of 0.25 sec. Set the time axis for 0 to 6 time constants.

  Design a controller for the rotpen kit

Linearise a non-linear Simulink pendulum model to obtain the matrices A, B, C, D which define the state-space system - see Eq. 1. All hardware gains are taken care of in the Labview program, hence they do not need to be considered in the modelling..

  Describe how you would access these 4 members

Create a namespace titled global Type that contains four members. The members should be two named constants, n and rate. It should also contain a variable count and the function printResult. Describe how you would access these 4 members in a progr..

  Ilab overview

you will develop a policy statement and the processes and procedures that can be used to drive the design, implementation, and maintenance of a wireless network in a SOHO (small office, home office) setting.

  Matlab program that ?nds one root of a polynomial equation

Write a MATLAB program that ?nds one root of a polynomial equation using the Bisection method. A script ?le in MATLAB is a ?le that contains a sequence of MATLAB statements.

  The train will be unsafe if the normal acceleration is

a train track is designed with a radius of 20 meters. the train will be unsafe if the normal acceleration is greater

  Compute the output response

Write a MATLAB M-file to compute the output response y[n] of the 6-point MA filter to the input x[n]=5sin(pn/10 + p/4), for 0

  What is the difference between a script and function

Learn how to use various MATLAB built-in functions, What is the difference between a script and function? How do you create a new script or function in MATLAB

  Coefficients of the least squares fit

Write a Sa/Mkrus function that takes as its input the data and plots the data points and the least squares linear fit to the data. The function should also return the coefficients of the least squares fit.

  Write a matlab script called estimate_e

How does your actual accuracy compare to the relative tolerance you chose - Can you provide the answer as soon as possible and use basic MATLAB concepts to make this program?

  Determines which member has the largest magnitude force

Determines which member has the largest magnitude force. Reports to the Command Window which member has the largest magnitude force and the value of the force in that member.

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