Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 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 named PurchaseHigh, which should also store the initial purchase price value.
2. Locate the stock with the highest current purchase price and place its name (abbreviation) within a new variable named CurrentHigh, which should also store the current price value of the stock.
3. Create a single row variable named BestID containing the names of all stocks that have increased in value (from initial purchase price to current purchase price) by more than 30%.
4. 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%.
5. 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 BestID immediately (use the equation (CurrentPurchasePrice - InitialPurchasePrice)*NumberOfShares).
6. 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 #N.
7. 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 for 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.
8. 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.
image text in transcribed
image text in transcribed
image text in transcribed
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

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_2

Step: 3

blur-text-image_3

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

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

Are they spending less time with family and friends?

Answered: 1 week ago

Question

1 0 1 . 1 1 0 1 The equivalent base - 1 0 number is

Answered: 1 week ago

Question

Finding and scheduling appointments with new prospective clients.

Answered: 1 week ago