5) Write Matlab expressions to extract only the elements at odd positions in a vector (i.e....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
5) Write Matlab expressions to extract only the elements at odd positions in a vector (i.e. the 1st, 3rd, 5th, 7th..., elements of the vector), regardless of the length of the vector. Make sure your expression can work on vectors with odd or even number of elements. 6) A vector OrderData stores a sequence of numbers that represent the unit price and order quantity of several products. The variable can be defined using the following expression in Matlab command window: >>OrderData=[25.3,18,14.0,82,43.0,17,22.5,33,21.5,35,9.5,112,65.2,35]; As an example, the first product is priced at $25.30 per unit and 18 of it are ordered; the second item is priced at $14.0 per unit and 82 are ordered, and so on. Write Matlab codes to: (1) programmingly convert this vector OrderData into two separate vectors, one that stores the unit price and another that stores the order quantity. Note: you cannot "manually" type the numbers to create two vectors. You have to use Matlab code to create the new vectors based on the original vector. (2) use the array multiplication operator to create a new vector, storing in this new vector the total price for every product. 5) Write Matlab expressions to extract only the elements at odd positions in a vector (i.e. the 1st, 3rd, 5th, 7th..., elements of the vector), regardless of the length of the vector. Make sure your expression can work on vectors with odd or even number of elements. 6) A vector OrderData stores a sequence of numbers that represent the unit price and order quantity of several products. The variable can be defined using the following expression in Matlab command window: >>OrderData=[25.3,18,14.0,82,43.0,17,22.5,33,21.5,35,9.5,112,65.2,35]; As an example, the first product is priced at $25.30 per unit and 18 of it are ordered; the second item is priced at $14.0 per unit and 82 are ordered, and so on. Write Matlab codes to: (1) programmingly convert this vector OrderData into two separate vectors, one that stores the unit price and another that stores the order quantity. Note: you cannot "manually" type the numbers to create two vectors. You have to use Matlab code to create the new vectors based on the original vector. (2) use the array multiplication operator to create a new vector, storing in this new vector the total price for every product.
Expert Answer:
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Posted Date:
Students also viewed these programming questions
-
If you have never had a job, describe an EVP that you would like a job to provide you in the near future.
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
The Rosa model of Mohave Corp. is currently manufactured as a very plain umbrella with no decoration. The company is considering changing this product to a much more decorative model by adding a...
-
Solve the linear programming problems stated in Problem Minimize and maximize P = 12x- + 14y subject to -2x: + y 6 x + y 15 3x - y 0 x, y 0
-
Purchasing power parity assumes there are neither transaction costs nor regulations which limit the ability to buy and sell goods across different countries. In many cases, these assumptions are...
-
Client Facilities Tour. When an auditor has accepted an engagement from a new client who is a manufacturer, it is customary for the auditor to tour the client's plant facilities. Discuss the ways in...
-
On April 1, 2012, Cyclones Backhoe Co. purchases a trencher for $280,000. The machine is expected to last five years and have a salvage value of $40,000. Compute depreciation expense for both 2012...
-
1. Determine the value of c such that the function is continuous over the set of real numbers. 1x-31 f ( x ) = x
-
The Salida Salt Company is considering making a bid to supply the highway department with rock salt to drop on roads in the county during the winter. The contract will guarantee a minimum of 25,000...
-
Argentine Float. The Argentine peso was fixed through a currency board at Ps1.00/$ throughout the 1990s. In January 2002, the Argentine peso was floated. On January 29, 2003, it was trading at...
-
Give two reasons why auditors might wish to download data from another machine onto the machine on which their generalized audit software package resides.
-
How can auditors use generalized audit software to assist the conduct of analytical review?
-
Briefly explain the parallel simulation technique. What is the purpose of using parallel simulation? Outline some of the advantages and disadvantages of using this technique for audit purposes.
-
Briefly describe the major phases that must be managed during the development and implementation of a generalized audit software application.
-
SoakNSun Swim Park sells individual and family tickets, which include a meal, 3 beverages, and unlimited use of the swimming pools. SoakNSun has the following ticket prices and variable costs for...
-
Item 4On January 1, 2024, Legion Company sold $225,000 of 10% ten-yearbonds. Interest is payable semiannually on June 30 and December 31.The bonds were sold for $199,193, priced to yield 12%. Legio 2...
-
The trade-off theory relies on the threat of financial distress. But why should a public corporation ever have to land in financial distress? According to the theory, the firm should operate at the...
-
Divide into groups of three or four students each. Each group should choose a company in the technology industry, such as Yahoo!, ebay, Apple, or Microsoft. Obtain the companys annual report or SEC...
-
Inventory Costing Methods} On June 1, Welding Products Company had a beginning inventory of 210 cases of welding rods that had been purchased for \(\$ 88\) per case. Welding Products purchased 1,150...
-
Effects of Inventory Costing Methods Borgia Enterprises has the following statement of earnings data available for 2018: Borgia uses a perpetual inventory accounting system and the weighted average...
Study smarter with the SolutionInn App