Question: I need help coding problem 3 in matlab, please. this's the second time am posting this. Problem 3: You are provided a 2x1 cell array
Problem #3 Background: You are provided a 2xl cell array named Stocks. The first element holds a cell array that contains a row vector of N-number text strings; these text strings are abbreviations of various stocks on the New York Stock Exchange. The second element of Stocks holds a 3xN matrix which contains information regarding each respective stock (Note: the row vector in the first element of Stocks contains the same number of columns (N) as the matrix in the second element of Stocks). The first row of this matrix contains the initial purchase price of any given stock; the second row of this matrix contains the current purchase price of any given stock; the third row of this matrix contains the number of shares of any given stock. Using this information, create a code that computes the following steps 1. Locate the stock with the highest initial purchase price and place its name (abbreviation) within a new variable 2. Locate the stock with the highest current purchase price and place its name (abbreviation) within a new variable 3. Create a single row variable named BestID containing the names ofall stocks that have increased in value (from named PurchaseHigh, which should also store the initial purchase price value. named CurrentHigh, which should also store the current price value of the stock. initial purchase price to current purchase price) by more than 30% Create a single row variable named BestPercent that contains the exact percentage increases of each stock found in BestID -for obvious reasons, none of these percentages should be below 30 Create a single row variable named Profit that contains the profit to be made if one were to sell each of the stocks found in BestD immediately (use the equation (CurrentPurchasePrice InitialPurchasePrice)"NumberOfShares) Create a 2xN matrix named Rank. In this variable, rank the stocks by both initial purchase price (in the first row) and current purchase price (in the second row). The stocks stored in CurrentHigh and PurchaseHigh should be ranked #1 in their respective categories, and the least valued stocks should be rank In a formatted output statement, output to the command window the information stored in CurrentHigh and PurchaseHigh. Also, using the information stored in Rank, find a way to provide a progress report on these two stocks-you know that PurchaseHigh is rank #1 or the initial purchase price category, so inform the user as to its rank in terms of its current purchase price (and the reverse for the stock stored in CurrentHigh). See the example given below for formatting In a formatted output statement, output to the command window the stock that experienced the greatest value increase: include the name of the stock, both of its purchase prices, and its percentage increase 5. 6
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
