Answered step by step
Verified Expert Solution
Question
1 Approved Answer
a. b. Implement a function that shifts a given vector to the right by k. For example, for the vector [1, 2, 3, 4]
a. b. 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. 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
Explanation The above code is a MATLAB function that shifts a given vector to the right by k positions The function takes two inputs the vector and th...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started