Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1. (total = 10%) Pretend that the function diff does not exist. Implement the function on your own in a script file. Make

image text in transcribedimage text in transcribed

Question 1. (total = 10%) Pretend that the function diff does not exist. Implement the function on your own in a script file. Make the solution generic for any input vector. You own a computer store that sells laptops of various brands. You are considering giving a 10% discount on the current prices. However, you are worried that if you give the discount you will lose in terms of revenue. You asked a forecasting firm to predict the next month's sales (in quantity) with and without the discount. Using the data below, compute the revenues with and without discount, and decide if you will proceed with the discount. You must use vector and/or matrix operations in the solution. a. b. The script should print the revenue before & after and print a Boolean true (1) or false (0) for whether you will give discount or not that will be computed for the specific input. You may solve for the specific example below. Here is the data you need for the analysis: Prices: Brand P&H CAM LLED Microhard Forecasted quantities: Brand P&H CAM LLED Microhard Price Before Discount 1000 1200 1100 1400 Quantities before Discount 50 100 120 30 Quantities after Discount 55 110 125 50 Question 1. (total = 10%) Implement a function that shifts a given vector to the right by k. For example, for the vector [1, 2, 3, 4] the result for k=1 would be [4, 1, 2, 3] and for k=2 would be [3, 4, 1, 2] (every element shifts to the right k times, if the right boundary is reached the elements go to the left side of the vector). The function (or script) should take a vector and a value of k and return the shifted vector. In your solution, you may not apply the built-in function circshift that shifts arrays in MATLAB, but you can debug your code using that function. You own a computer store that sells laptops of various brands. You are considering giving a 10% discount on the current prices. However, you are worried that if you give the discount you will lose in terms of revenue. You asked a forecasting firm to predict the next month's sales (in quantity) with and without the discount. Using the data below, compute the revenues with and without discount, and decide if you will proceed with the discount. You must use vector and/or matrix operations in the solution. a. b. The script should print the revenue before & after and print a Boolean true (1) or false (0) for whether you will give discount or not that will be computed for the specific input. You may solve for the specific example below. Here is the data you need for the analysis: Prices: Brand P&H CAM LLED Microhard Forecasted quantities: Brand P&H CAM LLED Microhard Price Before Discount 1000 1200 1100 1400 Quantities before Discount 50 100 120 30 Quantities after Discount 51 105 122 35

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Matlab An Introduction with Applications

Authors: Amos Gilat

5th edition

1118629868, 978-1118801802, 1118801806, 978-1118629864

More Books

Students also viewed these Databases questions