Assume you have a 2 x 1 cell array named Stocks. The top element is a cell array containing a single row of N character arrays, each of which is the abbreviation for a stock on the New York Stock Exchange. The bottom element of Stocks is a 3 x N matrix containing information about the stocks listed in the top row. Each column of this matrix (three values) represents the values of the stock in the corresponding position in character arrays of the top row of Stocks at two different times as well as the number of shares owned. The top row of this matrix represents the original purchase price, the second row represents the current price, and the bottom row contains the number of shares. Answer the following questions. Each should be answered with a single MATLAB statement if possible. (a) Place the abbreviation of the stock with the highest current price in CurrentHigh. (b) Place the abbreviation of the stock with the lowest purchase price in Cheapest. (c) Create a single row M-element cell array named Best containing the abbreviations of all stocks that have increased in value by more than 25%. (d) Create a 2 x 1 cell array named Profits. The top element contains the abbreviations of the stocks found in part (c) above in an M-element single-row cell array, and the bottom element contains an M-element row vector containing the amount of profit that would be made by selling each stock. (Calculated by (Current Price - Purchase Price) Number of shares.) I (e) Place the total profit that would be made by selling all of the shares from the preceding question into the variable TotalProfits. Script e A Save C Reset DI MATLAB Documentation 1 Variables to be used 2 Inputs 3 Stocks - cell array containing top element - cell array containing single row of stock abbreviations (character arrays) bottom element - matrix 3 x N matrix of purchase price (row 1), current price (row 2), and number of stocks (row 3) 4% 7 Outputs 8 CurrentHight - character array of stock with the highest current price 9 Cheapest 10 Best 11 Profits - 2 x 1 cell array containign 12 % 13% 14 Total Profits- scalar containing total profit from selling all stocks in Best character array of stock with the lowest purchase price cell array containing character array of stocks which have increased by 25% in value element 1 - single-row cell array of stocks found in Best element 2 - single-row vector contain profit from selling each stock in Best 15 16 Inputs 17 Generate_Stocks This script generates the cell array Stocks. 18 19 Program 20 Write your program here 21 Stocks 22 23
Assume you have a 2 x 1 cell array named Stocks. The top element is a cell array containing a single row of N character arrays, each of which is the abbreviation for a stock on the New York Stock Exchange. The bottom element of Stocks is a 3 x N matrix containing information about the stocks listed in the top row. Each column of this matrix (three values) represents the values of the stock in the corresponding position in character arrays of the top row of Stocks at two different times as well as the number of shares owned. The top row of this matrix represents the original purchase price, the second row represents the current price, and the bottom row contains the number of shares. Answer the following questions. Each should be answered with a single MATLAB statement if possible. (a) Place the abbreviation of the stock with the highest current price in CurrentHigh. (b) Place the abbreviation of the stock with the lowest purchase price in Cheapest. (c) Create a single row M-element cell array named Best containing the abbreviations of all stocks that have increased in value by more than 25%. (d) Create a 2 x 1 cell array named Profits. The top element contains the abbreviations of the stocks found in part (c) above in an M-element single-row cell array, and the bottom element contains an M-element row vector containing the amount of profit that would be made by selling each stock. (Calculated by (Current Price - Purchase Price) Number of shares.) I (e) Place the total profit that would be made by selling all of the shares from the preceding question into the variable TotalProfits. Script e A Save C Reset DI MATLAB Documentation 1 Variables to be used 2 Inputs 3 Stocks - cell array containing top element - cell array containing single row of stock abbreviations (character arrays) bottom element - matrix 3 x N matrix of purchase price (row 1), current price (row 2), and number of stocks (row 3) 4% 7 Outputs 8 CurrentHight - character array of stock with the highest current price 9 Cheapest 10 Best 11 Profits - 2 x 1 cell array containign 12 % 13% 14 Total Profits- scalar containing total profit from selling all stocks in Best character array of stock with the lowest purchase price cell array containing character array of stocks which have increased by 25% in value element 1 - single-row cell array of stocks found in Best element 2 - single-row vector contain profit from selling each stock in Best 15 16 Inputs 17 Generate_Stocks This script generates the cell array Stocks. 18 19 Program 20 Write your program here 21 Stocks 22 23
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
MATLAB. write code for all parts
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education