Question

Please use Matlab!!! 6) A vector OrderData stores a sequence of numbers that represent the unit...

Please use Matlab!!!

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: >>OrderData=[33.0,10,40.0,8,20.0,7,28.0,12,10.5,25,7.5,12,15.2,25]; As an example, the first product is priced at $33.0 per unit and 10 of it are ordered; the second item is priced at $40 per unit and 8 are ordered, and so on. Write 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;

(2) use the array multiplication operator to create a new vector, storing in this new vector the total price for every product.

Homework Answers

Answer #1

OrderData=[33.0,10,40.0,8,20.0,7,28.0,12,10.5,25,7.5,12,15.2,25];
unit_price = [];
order_quantity = [];

for i=1:2:length(OrderData)
    unit_price(1+length(unit_price)) = OrderData(i);
    order_quantity(1+length(order_quantity)) = OrderData(i+1);
end

total_price = unit_price.*order_quantity;

unit_price
order_quantity
total_price



Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Assessment Module 9 – Marginal Analysis Please create a tab in your Excel Workbook and name...
Assessment Module 9 – Marginal Analysis Please create a tab in your Excel Workbook and name it “Module 9 Marginal Analysis.” You have same basic templates in your Resources workbook, but you may need to modify these to fit the individual business problem. I am evaluating your professional ability to do so, and to create professional models and reports, so take your time, think through a logical, clear, well-structured, well-formatted model. Remember, assumption tables (like T-accounts) are your friends! Be...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary rivals? How will the acquisition of Reebok by Adidas impact the structure of the athletic shoe industry? Is this likely to be favorable or unfavorable for New Balance? 2- What issues does New Balance management need to address? 3-What recommendations would you make to New Balance Management? What does New Balance need to do to continue to be successful? Should management continue to invest...
After reading the following article, how would you summarize it? What conclusions can be made about...
After reading the following article, how would you summarize it? What conclusions can be made about Amazon? Case 12: Amazon.com Inc.: Retailing Giant to High-Tech Player? (Internet Companies) Overview Founded by Jeff Bezos, online giant Amazon.com, Inc. (Amazon), was incorporated in the state of Washington in July 1994, and sold its first book in July 1995. In May 1997, Amazon (AMZN) completed its initial public offering and its common stock was listed on the NASDAQ Global Select Market. Amazon quickly...
1. What is an ISP (Integrated Service Provider) for supply chains? (1 point) A. A consultant...
1. What is an ISP (Integrated Service Provider) for supply chains? (1 point) A. A consultant agency which integrates the supply chain for companies B. A 2 PL or a 3PL, but not a 4PL C. A company supplying transportation and warehousing services D. A logistics service company specialized in suppling VAS (value added services) 2. What characterizes a 4 PL? (1 point) A. They are non-asset based and provides integrated services primarily supplied by asset based providers, for example...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT