Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use the Programming Language ---- > MATLAB <--- Add stockPrice to the beginning

ID: 3857832 • Letter: U

Question

Use the Programming Language         ---- > MATLAB <---

Add stockPrice to the beginning of row array tickerTape Ex: If stockPrice is 108.44 and tickerTape is [109.26, 108.65, 106.96], then tickerTape becomes [108.44, 109.26, 108.65, 106.96] Your Function P Save Reset MATLAB Documentation 1 function tickerTapeRecordPrice(stockPrice, tickerTape) 2% StockPrice : Most recent stock price 13% tickerTape : Array of previous stock prices 4 % Add stockPrice to the beginning of row array ticke rTape ticke rTape-0; 7 8 end Code to call your function C Reset RecordPrice(108.44, [109.26, 108.65, 106.96]) Run Function Assessments Tests Submit Check if RecordPrice(108.44, [109.26, 108.65, 106.96]) becomes [108.44, 109.26, 108.65, 106.96] 44, (109.26, 108.65,1

Explanation / Answer

we can do in different ways:

1.

function tickerTape = RecordPrice(stockPrice, tickerTape)

              tickerTape = [stockPrice, tickerTape];

end

RecordPrice(108.44, [109.26, 108.65, 106.96])

2.

function tickerTape = RecordPrice(stockPrice, tickerTape)

              tickerTape = horzcat([stockPrice], tickerTape);

end

RecordPrice(108.44, [109.26, 108.65, 106.96])