The MATLAB question: You should now be familiar with MATLAB's built-in max function. Without using the built-in
Fantastic news! We've Found the answer you've been seeking!
Question:
The MATLAB question:
Transcribed Image Text:
You should now be familiar with MATLAB's built-in "max" function. Without using the built-in max(), min() and sort() functions, write a function that takes vector as an input and returns the maximum value as well as the index at which the maximum value occurs. Your function should work with input vectors of any length. Your function header should be similar to the following: function [max_value, index] = mymax(x) Test your function for f(x)=x(¹/x) for values between 0 and 50 with a step size of 0.001. Check the maximum value and index using MATLAB's built-in max() function. Plot f(x) and mark the maximum point. Remember to include a legend. *Although not necessary for this task, think about how you would code this for a two-dimensional matrix by creating a function which finds the maximum value and its corresponding row and column. function [max_value, row, column] = mymax2(x) You should now be familiar with MATLAB's built-in "max" function. Without using the built-in max(), min() and sort() functions, write a function that takes vector as an input and returns the maximum value as well as the index at which the maximum value occurs. Your function should work with input vectors of any length. Your function header should be similar to the following: function [max_value, index] = mymax(x) Test your function for f(x)=x(¹/x) for values between 0 and 50 with a step size of 0.001. Check the maximum value and index using MATLAB's built-in max() function. Plot f(x) and mark the maximum point. Remember to include a legend. *Although not necessary for this task, think about how you would code this for a two-dimensional matrix by creating a function which finds the maximum value and its corresponding row and column. function [max_value, row, column] = mymax2(x)
Expert Answer:
Answer rating: 100% (QA)
ANSWER CODE mymax function maxvalueindexmymaxx maxva... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
array to work out the total heads and tails total_no_heads = sum(trials 1) total_no_tails = sum(trials == 0)
-
Jaco has 11 different pamphlets which he wishes to put in 4 mail boxes labelled A, B, C and D. In how many different ways may he put the pamphlets in the mail boxes in such a way that mail box D gets...
-
Use MATLAB to construct a matrix A by setting A = vander(1 : 6); A = A - diag(sum(A)) (a) By construction, the entries in each row of A should all add up to zero. To check this, set x = ones(6, l)...
-
The table below gives the marginal abatement costs of three polluting firms in an industry. The industry is regulated with an emission tax of $9. Emissions. (tons/week) 10 9 8 7 6 5 4 3 2 1 0...
-
The midpoint of a side of a triangle in R3 is the point that bisects that side (i.e., that divides it into two equal pieces). Let be a triangle in R3 with sides A, B, and C and let L denote the line...
-
Solve each polynomial inequality in Exercises 142 and graph the solution set on a real number line. Express each solution set in interval notation. 4x + 1 = 4x
-
Use supply and demand curves to illustrate how a central bank conducts monetary policy using open market operations, a discount window and altering reserve levels.
-
The stockholders' equity section on the balance sheet of Dillard's, a popular department store, is shown below. The company earned net income of $122,726,000 and declared and paid dividends of...
-
Asset Actual Start Date {c} Actual Finish Date {c} Days to complete AIM001442 Mar/12/2021 Apr/09/2021 28 AIM001508 May/11/2021 Jun/08/2021 28 AIM002148 May/18/2021 Jun/15/2021 28 AIM002264...
-
Madison Capital Group is considering allocating a limited amount of capital investment funds among four proposals. The amount of proposed investment, estimated income from operations, and net cash...
-
Two small chemical feed pumps are under consid- eration for pumping a corrosive liquid from a 8.15 8.16 8.17 catalytic reforming process in a refinery. A pump with a brass impeller costs $800 and is...
-
The management of a fitness facility in Sheffield is looking to replace their current system of reliance on grid gas and electricity with a biomass powered Combined Heat and Power (CHP) system for...
-
Complete the following table: Note: Do not round intermediate calculations. Round your final answers to the nearest cent. Item List price Sony digital camera $ 318 Chain discount 8/4/2 Trade Net...
-
6. (20 points) Consider the following list of projects (data in millions): Investment PW(15%) Alternative 1 $100 2 $303 3 $317 $235 $573 $283 $647 $665 $1642 $132 $660 $941 Payback 12 7 5 4 Assume...
-
A5- drywall screw is countersunk (i.e., screwed until it is below the surface of the drywall) by to fasten a 16 4 "sheet of drywall to the ceiling joist. (a) How much of the screw extends into the...
-
Consider the rural intersection attached. Can this intersection be safely operated under basic rules-of- the-road? If not, what type of control would you suggest? You may assume that a traffic signal...
-
Use the following partial listing of T accounts to complete this exercise. Accumulated Depreciation-Office Equipment Bal. 110 Wages Payable Bal. 260 Raquel Zapata, Capital Bal. 6,000 Raquel Zapata,...
-
$10,000 was borrowed at 3.5% on July 17. The borrower repaid $5000 on August 12, and $2000 on September 18. What final payment is required on November 12 to fully repay the loan?
-
Determine the matrix representation of each of the following composite transformations. (a) A yaw of 90, followed by a pitch of 90 (b) A pitch of 90, followed by a yaw of 90J (c) A pitch of 45,...
-
Let A be the matrix given in Exercise 21. For each of your solutions x to Exercise 21(b), compute Ax and compare it to Pb.
-
Let aj be a nonzero column vector of an m x n matrix A. Is it possible for aj to be in N(AT)? Explain.
-
You have the following summarised trial balance for Stock High plc as at 31 March 2013. Further details are provided in the notes. 1. At the statement of fi nancial position date 8 is owing for...
-
Atmel Inc. manufactures and sells two products. Data with regard to these products are given below. Total budgeted machine hours are 100,000. The budgeted overhead costs are shown below. Using...
-
A profitable company with five departments uses plant-wide overhead rates for its highly diversified operation. The firm is studying a change to either allocating overhead by using departmental rates...
Study smarter with the SolutionInn App