Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 7 (5 points) Difficulty: Moderate To complete this Exercise, you will need to read the textbook Section 2.6, Pages 134-137, and review the settings

Exercise 7 (5 points) Difficulty: Moderate

To complete this Exercise, you will need to read the textbook Section 2.6, Pages 134-137, and review the settings and formulas in Exercises 13-15 on Page 139.

**Create a function that begins with

function x = production(C,d)

n=size(C,2);

x=[];

It takes as inputs an n x n matrix C and a vector d with n entries. The output, for the valid inputs, will be the non-empty production vector x.

**First your function has to check whether C and d are valid inputs for which it is guaranteed the existence of a unique economically feasible output x (refer to Theorem 11 in Section 2.6). If either C or d or both are not valid inputs, output the corresponding message (or messages) that have to be specific which of the inputs is/are not valid? If at least one of the inputs is not valid, the program terminates, and the empty output for x will stay.

If both inputs, C and d, are valid, your function will continue: **First, output the production vector x from the equation (2) (see above). You can use the MATLAB function inv() for this part. Do not display x here.

**Verify that x is an economically feasible output, that is, its entries are non-negative numbers.

If your code does not confirm that x is economically feasible, output a message disp('check the code!')

and terminate the program - the empty output for x will stay.

If your code confirms that x is a valid output, display the vector x with a message: disp('the unique production vector is') x

and your function will continue with one more task: instead of equation (2), you will be using now the recurrence formula in Exercise 15 on Page 139 to output the production vector with a desired accuracy. As a reference value, you will be using the output x, and your code will also output (and display) the number of iterations needed to match the reference value. (Prior to working on this part, you may find it useful to read Pages 136-137 of the textbook.)

**Proceed in the following way:

Assign initially

x0=d;

and, then, calculate the consecutive iterations using the recurrence formula in Exercise 15. Your loop will terminate when the function closetozeroroundoff with p=1, when run on the vector of difference between x and a consecutive iteration, outputs the zero vector. Assign the last iteration to the vector x1 and output it with the message:

disp('the production vector calculated by recurrence relation is')

x1

Count and display the number of iterations, k, needed to archive this accuracy:

fprintf('the number of iteration to match the output x is %i ',k) This is the end of the function production.

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

Step: 3

blur-text-image

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

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions