Write a Matlab function that converts calendar months (input as numbers, 1-12) to seasons (output as...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a Matlab function that converts calendar months (input as numbers, 1-12) to seasons (output as numbers, 1-4). Months 12 and 1-2 are season 1 [winter], 3-5 are season 2 [spring], 6-8 are season 3 [summer], 9-11 season 4 [fall]. Have the function exit with an error (Matlab error()) if the input month is not an integer, or is not between 1 and 12. Include help text to tell users what the function does. Check the function with a valid input (such as 7) and an invalid input (such as 0) Hint: You can use an if...else...then statement, to set the value of the output season to 1-4 depending on the month, and to signal an error if the input month was not an integer or not between 1 and 12. It's also possible to use a switch...case statement to do the same thing. Write a Matlab function that converts calendar months (input as numbers, 1-12) to seasons (output as numbers, 1-4). Months 12 and 1-2 are season 1 [winter], 3-5 are season 2 [spring], 6-8 are season 3 [summer], 9-11 season 4 [fall]. Have the function exit with an error (Matlab error()) if the input month is not an integer, or is not between 1 and 12. Include help text to tell users what the function does. Check the function with a valid input (such as 7) and an invalid input (such as 0) Hint: You can use an if...else...then statement, to set the value of the output season to 1-4 depending on the month, and to signal an error if the input month was not an integer or not between 1 and 12. It's also possible to use a switch...case statement to do the same thing.
Expert Answer:
Answer rating: 100% (QA)
Certainly Below is a MATLAB function that fulfills the specified requirem... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
One year Perry had the lowest ERA (earned-run average, mean number of runs yielded per nine innings pitched) of any male pitcher at his school, with an ERA of 2.83. Also, Sally had the lowest ERA of...
-
QUIZ... Let D be a poset and let f : D D be a monotone function. (i) Give the definition of the least pre-fixed point, fix (f), of f. Show that fix (f) is a fixed point of f. [5 marks] (ii) Show that...
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
Jellio, Maker of Whimsical Furnishings, Considers Growth. Start by asking yourself, who is the customer for this product, not who is currently buying it. There is a difference. Then, where would they...
-
a. Do the following compounds have any asymmetric carbons? 1.CH2==C==CH2 2. CH3CH==C==CHCH3 b. Are they chiral? (Hint: Make models.)
-
When examining the audit process as a whole, there are three key phases of the process. Describe each phase and what activity you will engage in throughout each phase. Be specific as to what each...
-
Which backup method is the fastest? a. full daily backup c. differential daily backup b. incremental daily backup d. complete daily backup
-
If Norm decides to put the decision to the appropriate production team, what are the potential problems? What would be the advantages? MINI CASE As Norm St. Laurent, operations manager for Oilwell...
-
For the year just completed, Hanna Company had net income of $72,000. Balances in the company's current asset and current liability accounts at the beginning and end of the year were as follows:...
-
The Walton Toy Company manufactures a line of dolls and a sewing kit. Demand for the company's products is increasing, and management requests assistance from you in determining an economical sales...
-
Write a program to find properties of a group of numbers. Please Enter the total number of group's member please enter 1. number: 12 please enter 2. number: 56 please enter 3. number: -90 : 6 please...
-
Determine the cost of the project and the revenues from the project for the period management wishes to analyze. For example, a firm wants to start a new widget plant. The cost of the plant is...
-
Texas Chemicals is a major producer of oil-based fertilisers in the US.The company's stock is currently selling for $80 per share and there are 10 million shares outstanding. The company also has...
-
Peace Corporation just paid a dividend of $1.05 a share (Do = $1.05). The dividend is expected to grow by 6% annually for the foreseeable future. What is the expected value of the dividend 1 year...
-
The errors of the forecasts have been calculated using 4 methods, which are shown below: Method Average Error MAD A)3-month moving average 0.7 7.40 B) Moving average 3-month weighted -0.3 8.40...
-
2. Suppose your company provides a $50,000 three-year loan to the partner at a variable rate. The initial variable is 12%. The initial funds come from two sources: own savings $25,000 (assuming zero...
-
Senior management at a software development firm met with its vice president of HR to discuss the implementation of the company's differentiation strategy for its products and services. They asked...
-
In a certain school district, 3% of the faculty use none of their sick days in a school year. Find the probability that 5 faculty members selected at random used no sick days in a given year.
-
A rocket flying straight up measures the angle e with the horizon at different heights h. Write a MATLAB program in a script file that calculates the radius of the earth R (assuming the earth is a...
-
Divide the polynomial -0.24x7 + 1.6x6 + 1.5x5 - 7.41x4 - 1.8x3 - 4x2 - 75.2x - 91 by the polynomial -0.8x3 + 5x + 6.5.
-
An isolated prime is a prime number p such that neither p - 2 nor p + 2 is prime. For example, 47 is an isolated prime since 45 and 49 are both not primes. Write a computer program that finds all the...
-
Refer to the balance sheet data given in Exercise E13-3B. a. Prepare common-size balance sheets for each year (use total assets as the base amount for computing percentages). b. Compare the...
-
Purple Company has a current ratio of 2.2 on December 31. On that date its current assets are as follows: Purple Company's current liabilities at the beginning of the year were \(\$ 195,000\) and...
-
The following information is available for Virginia Company: Calculate the following ratios for 2019: a. Gross profit percentage b. Return on sales c. Asset turnover d. Return on assets e. Return on...
Study smarter with the SolutionInn App