1 answer

Matlab coding assistance. Having some difficulty please help! thank you so much in advance! %% Task...

Question:

Matlab coding assistance. Having some difficulty please help! thank you so much in advance!

%% Task 9

% use logical tests to locate and update subsets of a matrix

% Step 1: Create vec, a row vector of 5 random integers on the closed interval [-10,10].

% Step 2: Use a logical mask to count the number of positive values (code provided is already sufficient)

mask = vec > 0

count = sum(mask)

% Step 3: Use the find function to locate where the positive values are in

% the vector (code provided is already sufficient)

inds = find(vec > 0)

% Step 4: Display only the positive values in vec (index into vec using the inds variable)

% Step 5: Negate the positive values by indexing into

% vec using the mask variable, and multiplying all those values by -1

.

%% Task 10

% Matrix multiplication

% Step 1:

%a) Define matrices A, B, and C as shown in Ex 42

% b) compute the expressions 3*A and A+3

% c) compute the expressions A*C, C*A, C*C and C.*C

% comment out any expression that does not compute successfully

% c) compute the expressions A*A and A.*A

% (Be sure you understand the difference between these two operations.

% Step 2:

% a) define matrices A, B and C as shown in Ex 43

% b) compute the matrix operations A*A,B*B and C*C

% comment out any expression that does not compute successfully

% c) use the size function to display the dimensions of B and C

% then compute the matrix operations B*C and C*B

% comment out any expression that does not compute successfully

% (Be sure you understand how to predict which the matrix products will

% compute, along with the dimensions of the result.)


Answers

>>r = randi([10 50],-10,10); //a row vector of 5 random integers on the closed interval [-10,10] 

>>vec=r;

Display only the positive values in vec (index into vec using the inds variable)

len=length(vec);
for inds=1:len;

if vec(inds)>=0

P(inds)=vec(inds);

end

disp(P)

.

Similar Solved Questions

1 answer
How to configure router 1 to be able to communicate with other routers using one ip...
how to configure router 1 to be able to communicate with other routers using one ip address instead of 4 Configure and install a summary route on R01 to allow PC1 to reach all networks on R02, R03, & R04 10.?.21.0/24 10.?.20.0/24 LOO Gig0/0 1.?.10/30 Gig0/0 R04 Se0/0/0 e Se0/0/0 Gig0/1 PC1 Gi...
1 answer
Gsuge the O Type hene to sec O Tyoe here to easch
gsuge the O Type hene to sec O Tyoe here to easch...
1 answer
Find the general solution of y" – 54"' + 6y' = 0. 8.8 A BRIEF TABLE...
Find the general solution of y" – 54"' + 6y' = 0. 8.8 A BRIEF TABLE OF LAPLACE TRANSFORMS F(s) (s > 0) n! " (s > 0) (1 - integer > 0) T(+1) I". P> -1 (8 >0) 8 a n! (8 - a)"+1 (x > 0) On integer > 0) Coswt (s > 0) 32.+wa sin! (8 > 0) EM cos...
1 answer
Internal pressure, at, can be written as What is at for a gas that follows the...
Internal pressure, at, can be written as What is at for a gas that follows the van der Waals equation? vdw eqn: P= NRT n'a V - nb V2 Note: a and b are empirical constants...
1 answer
What's the relationship between CO2, bicarbonate (HC03- ), and carbonic acid (H2CO3)? In what form is...
What's the relationship between CO2, bicarbonate (HC03- ), and carbonic acid (H2CO3)? In what form is most CO2 carried in our blood? What is the role of carbonic anhydrase in gas exchange?...
1 answer
I need positive thought and agree with the statement at leat 100 words 2. Why is...
i need positive thought and agree with the statement at leat 100 words 2. Why is it important for professionals to attend professional conferences and read the professional literature? If I want to say in summarized I would say to stay informed on the always expanding knowledge in the physical acti...
1 answer
Question 6 of 10 The medication order is as follows: VANCOMYCIN IVPB 1000 MG, 5% DEXTROSE...
Question 6 of 10 The medication order is as follows: VANCOMYCIN IVPB 1000 MG, 5% DEXTROSE IN WATER 200 ML once per day, INFUSE the medication over 90 minutes first dose now. What ml/hour flow rate will you set for the secondary infusion of VANCOMYCIN? Round to the nearest whole number...
1 answer
Leadership theories of organizational power and influence
leadership theories of organizational power and influence...
1 answer
21. Everspring, Inc. has the following data for 2018. its first year of operations (this means...
21. Everspring, Inc. has the following data for 2018. its first year of operations (this means all accounts had $0 beginning balances). Any over/under-applied overhead is closed out proportionately to the applicable accounts. Actual overhead $15,000 Cost of goods manufactured (unadjusted) $30,000 Co...
1 answer
Phoenix Company's 2017 master budget included the following fixed budget report. It is based on an...
Phoenix Company's 2017 master budget included the following fixed budget report. It is based on an expected production and sales volume of 15,000 units. PHOENIX COMPANY Fixed Budget Report For Year Ended December 31, 2017 $3,150,000 Sales Cost of goods sold Direct materials $960,000 225,000 45,0...
1 answer
8. Predetermined Overhead Rate, Application of Overhead to Jobs, Job Cost On April 1, Sangvikar Company...
8. Predetermined Overhead Rate, Application of Overhead to Jobs, Job Cost On April 1, Sangvikar Company had the following balances in its inventory accounts: Materials Inventory $12,940 Work-in-Process Inventory 21,200 Finished Goods Inventory 8,800 Work-in-process inventory is made up of three job...
1 answer
Region bounded by y=x², X=2 & axis a whats the integral that describes the volume or...
Region bounded by y=x², X=2 & axis a whats the integral that describes the volume or the solid made by rotating the region about the x a b) The y axis ? c) x=5?...
1 answer
Please show steps. i know its not 7.60 or 7.31 You add 1 L of 100...
please show steps. i know its not 7.60 or 7.31 You add 1 L of 100 mM HCl to 1 L of 100 mM Tris buffer (initial pH = 7.60 and a pka of 8.10). What is the approximate final pH? Select one: a. The final pH would be 12.70 b. The final pH would be 2.30 c. The final pH would be 12.08 d. The final pH woul...
1 answer
The cholesterol levels ( in milligrams per liter) of three randomly selected adult males is 260,...
The cholesterol levels ( in milligrams per liter) of three randomly selected adult males is 260, 315, 295. The standard error of the mean of these three levels is...
2 answers
How do you find the antiderivative of #f(x)=x^6#?
How do you find the antiderivative of #f(x)=x^6#?...
1 answer
EBP CASE STUDY You are consulting with the education and practice develop- documen ment team in...
EBP CASE STUDY You are consulting with the education and practice develop- documen ment team in a large tertiary care hospital serving a region exception using subjective, objective, assessment, and plan comprising mostly rural communities. The team is responsi (SOAP) and the hospital has made exten...
1 answer
4. Financial institutions Aa Aa Several market partidpants interact in developed markets to organize the exchange...
4. Financial institutions Aa Aa Several market partidpants interact in developed markets to organize the exchange of funds from buyers to sellers. Such institutions as investment banks, commercial banks, financial services corporations, credit unions, pension funds, life insurance companies, mutual ...