In MATlab Function newPriceTable = UpdatePriceTable(origPriceTable, changePrice,
ID: 3863972 • Letter: I
Question
In MATlab
Function newPriceTable = UpdatePriceTable(origPriceTable, changePrice, colNum) % UpdatePriceTable: Adds changePrice to column colNum of origPriceTable % Returns the updated price table newPriceTable % Inputs: origPriceTable - original price data table % changePrice - column array of pricing changes % colNum - specified column of priceTable to update % % Outputs: newPriceTable - updated price data table % Assign newPriceTable with data from priceTable; newPriceTable = [0, 0; 0, 0;]; % FIXME % Assign newPriceTable column specified by colNum with original price % data updated by changePrice newPriceTable = [0, 0; 0, 0;]; % FIXME end Run Your Solution Code to call your function when you click RunExplanation / Answer
%matlab code
function newPriceTable = UpdatePriceTable(origPriceTable, changePrice, colNum)
%update the original price table at given column
origPriceTable(:,colNum:colNum) = origPriceTable(:,colNum:colNum) + changePrice;
% update the newpricetable
newPriceTable = origPriceTable;
end
origPriceTable = [19.99, 9.99; 14.99, 8.99;];
changePrice = [ -1.00; -1.50; ];
colNum = 1;
newPriceTable = UpdatePriceTable(origPriceTable, changePrice, colNum)
%newPriceTable is [18.99, 9.99; 13.49, 8.99;].
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.