Question

In: Computer Science

Please create a matrix A by extract the first 9 entries(first 9 rows) from Ownership(income&lot size)...

Please create a matrix A by extract the first 9 entries(first 9 rows) from Ownership(income&lot size) and first 9 entries(first 9 rows) from Non ownership(income& lotsize) by using matlab from the table below:

Income Lot_Size Ownership
60 18.4 owner
85.5 16.8 owner
64.8 21.6 owner
61.5 20.8 owner
87 23.6 owner
110.1 19.2 owner
108 17.6 owner
82.8 22.4 owner
69 20 owner
93 20.8 owner
51 22 owner
81 20 owner
75 19.6 non-owner
52.8 20.8 non-owner
64.8 17.2 non-owner
43.2 20.4 non-owner
84 17.6 non-owner
49.2 17.6 non-owner
59.4 16 non-owner
66 18.4 non-owner
47.4 16.4 non-owner
33 18.8 non-owner
51 14 non-owner
63 14.8 non-owner

Solutions

Expert Solution

MATLAB CODE:

% Income vector
Income = [60, 85.5, 64.8, 61.5, 87, 110.1, 108, ...
    82.8, 69, 93, 51, 81, 75, 52.8, 64.8, 43.2, 84, ...
    49.2, 59.4, 66, 47.4, 33, 51, 63];
% Lot Size vector
Lot_Size = [18.4, 16.8, 21.6, 20.8, 23.6, 19.2, 17.6, 22.4, 20, ...
    20.8, 22, 20, 19.6, 20.8, 17.2, 20.4, 17.6, 17.6, ...
    16, 18.4, 16.4, 18.8, 14, 14.8];
% Ownership vector
Ownership = repelem(["owner", "non-owner"],12);
% Three vectors are stored into the Ownership Matrix
OwnershipData = [Income', Lot_Size', Ownership'];
countOwner = 0;
countNonOwner = 0;
A = []; % Matrix to store extracted entries (only column Income & Lot_Size)
for index = 1:length(OwnershipData)
    if(OwnershipData(index, 3) == "owner")
        % When 9 Ownership entries are added to the matrix A,
        % it will stop adding any more entries
        if(countOwner < 9)
            A = [A; OwnershipData(index, 1:2)];
            countOwner = countOwner + 1;
        end
    else
        % When 9 Non Ownership entries are added to the matrix A,
        % it will stop adding any more entries
        if(countNonOwner < 9)
            A = [A; OwnershipData(index, 1:2)];
            countNonOwner = countNonOwner + 1;
        end
    end
end

The Ownership matrix will look like this:

OUTPUT:

MATRIX A =


Related Solutions

MATLAB Create a matrix named P which has 2000 rows and 100 columns of all zeros....
MATLAB Create a matrix named P which has 2000 rows and 100 columns of all zeros. Replace the zeros in rows 46-58 and columns 3-18 of matrix P from the previous question with ones.
"Create a program that displays a table consisting of four rows and five columns. The first...
"Create a program that displays a table consisting of four rows and five columns. The first column should display the numbers 1 through 4. The second and sub-sequent columns should display the result of multiplying the number in the first column by the numbers 2 through 5. If necessary, create a new project named Introductory14 Project, and save it in the Cpp8\Chap08 folder. Enter the C++ instructions into a source file named Introductory14.cpp. Also enter appropriate comments and any additional...
2. Create a java program that reads a file line by line and extract the first...
2. Create a java program that reads a file line by line and extract the first word.        The program will ask for the name of input and output file. Input file: words.txt today tomorrow sam peterson peter small roy pratt Output file: outwords.txt tomorrow peterson small pratt
to create a common size income statement ---- all items on the income statement by -----...
to create a common size income statement ---- all items on the income statement by ----- a) divide; net income b) multiply; total revenue c) multiply; net income d) divide; total revenue
Create a random matrix of size 10x10, of integers between 1 and 1000, and use nested...
Create a random matrix of size 10x10, of integers between 1 and 1000, and use nested for loops over the elements of the matrix to find the number of prime elements , as well as the sum of the prime elements in the matrix. You can use MATLAB's built-in function isprime to check if an element is a prime number. You should have these variable: cnt (counts the number of prime elements) sm (sum of prime elements) In the command...
Write an essay on how to extract and create an IS-LM  (Keynesian model). Please use your OWN...
Write an essay on how to extract and create an IS-LM  (Keynesian model). Please use your OWN WORDS and graphs!!
Given the matrix A (2x2 matrix taking the first two column vectors from the input file),...
Given the matrix A (2x2 matrix taking the first two column vectors from the input file), compute the followings. Λ: the diagonal matrix whose diagonal elements are the corresponding eignevalues Λii = λi for i=1,2 R: the 2x2 matrix whose ith column vector is the eigenvector corresponding to λi for i=1,2 RΛRT: the matrix compositions 1/0: the comparison between A and RΛRT (is A= RΛRT?) Your output should have seven lines where the first two lines correspond to the 2x2...
An extract from the income statement of PoMA Ltd for the previous year is given below:                            &
An extract from the income statement of PoMA Ltd for the previous year is given below:                                                                                                                                                                                             Rs.                          Sales (50,000 units)                                         1,000,000 Direct materials                                                350,000                 Direct labor cost (50,000 hours)                 200,000                 Fixed manufacturing overhead                  190,000 Variable manufacturing overhead            50,000 Administration overheads                           180,000                 Selling and distribution overhead             120,000                                                                                                                                 The directors are keen to improve revenue and productivity and are considering various options.             You are the management accountant and are requested to compute the following:                                                                                                ...
(URGENT) An extract from the income statement of PoMA Ltd for the previous year is given...
(URGENT) An extract from the income statement of PoMA Ltd for the previous year is given below:                                                                                                                                                                                             Rs.                          Sales (50,000 units)                                         1,000,000 Direct materials                                                350,000                 Direct labor cost (50,000 hours)                 200,000                 Fixed manufacturing overhead                  240,000 Variable manufacturing overhead            50,000 Administration overheads                           180,000                 Selling and distribution overhead             120,000                                                                                                                                 The directors are keen to improve revenue and productivity and are considering various options.             You are the management accountant and are requested to compute the following:                                ...
URGENT An extract from the income statement of PoMA Ltd for the previous year is given...
URGENT An extract from the income statement of PoMA Ltd for the previous year is given below:                                                                                                                                                                                              Rs.                           Sales (50,000 units)                                         1,000,000 Direct materials                                                350,000                  Direct labor cost (50,000 hours)                 200,000                  Fixed manufacturing overhead                  210,000 Variable manufacturing overhead            50,000    Administration overheads                           180,000                  Selling and distribution overhead             120,000                                                                                                                                   The directors are keen to improve revenue and productivity and are considering various options.             You are the management accountant and are requested to compute the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT