Question

In: Computer Science

Make a 20 by 20 matrix in which diagonal elements are 21, 22, 23, 24 …...

Make a 20 by 20 matrix in which diagonal elements are 21, 22, 23, 24 … 40 and elements below the diagnol are ij = 2(i 2 j 2 ) and elements above the diagnol are 4×(i+j) Note: You must use if, elseif, else, end or/and if, end or/and if, else, end commands in MATLAB.

Solutions

Expert Solution

Thanks for the question, For the elements below diagonal I didnt understand the expression ij = 2(i 2 j 2 ), I have assumed it to as 2 *(i*i + j*j); If this needs to be changed please let me know in comments and I will update it.

========================================================================

matrix = zeros(20,20);

for i = 1: 20
for j = 1: 20
if i==j
matrix(i,j) = 20 +i;
elseif i>j
matrix(i,j) = 2*(i^2+j^2);
else
matrix(i,j) = 4*(i+j);
end
end   
end
matrix

=========================================================================


Related Solutions

Make a 20 by 20 matrix in which diagonal elements are 2, 5, 8, 11 ......
Make a 20 by 20 matrix in which diagonal elements are 2, 5, 8, 11 ... 59 and the first column is 21,22,23,24 ... 40 whereas the rest of the elements of the matrix are 9. Note: you must if, elseif, else, end or/and if, end or/and if, else, end commands in MATLAB.
Make a histogram of the following data {21, 22, 23, 24, 24, 24, 25, 25, 25,...
Make a histogram of the following data {21, 22, 23, 24, 24, 24, 25, 25, 25, 26, 27, 32, 34} The shape of the distribution is ___________________________________________________ Use your calculator to compute the mean of the data: __________________________________ Use your calculator to compute the standard deviation of the data ________________________ Give the five-number summary for this data: Item Value Draw the complete box-plot (including fences and outliers). Provide an accurate scale.                                                                                                              ...
1- 25 28 24 21 28 26 23 22 29 21 29 24 22 25 26...
1- 25 28 24 21 28 26 23 22 29 21 29 24 22 25 26 18 27 26 29 23 21 26 27 21 25 27 24 29 22 25 24 24 21 29 22 25 21 22 22 25 22 25 Calculate a) arithmetic mean and b) standard deviation of the sample. A) b) - Represent a classified frequency table. Answer the following questions in this table with column calculations. Calculate a) arithmetic mean, b) quadratic mean, c)...
Consider an orthogonal matrix Q ∈ R ^m×m and a diagonal matrix with non-zero diagonal elements...
Consider an orthogonal matrix Q ∈ R ^m×m and a diagonal matrix with non-zero diagonal elements D ∈ R^ m×m and answer the True— False questions below. (k) Any vector x ∈ R^m can be written as a linear combination of the columns of D (l) The columns of Q span R^m (m) The columns of D span R^m (n) The columns of Q are a basis for R^m (o) The columns of D are a basis for R^m
17, 18, 18, 18, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22,...
17, 18, 18, 18, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 23,23, 24,24,24,24,24,24,24,24,25,26,26,26,26,26,26,27,27,27,27,27,28,28,29,31,31,32,32,34,35,38 use the data to do the following: 1. sample mean 2. median 3. mode 4. standard deviation
MT scores: 11, 11, 16, 17, 19, 20, 21, 21 23 24 24 26 26 27...
MT scores: 11, 11, 16, 17, 19, 20, 21, 21 23 24 24 26 26 27 27 28 28 28 29 30 31 31 32 33 35 37 38 38 39 42 44 Questions for Class MT Score Distribution Analysis 1. Create a boxplot of MT scores. 2. Compute the probability that a randomly selected student from the class scored higher than 20. 3. Are the MT scores normally distributed? Why or why not? 4. Assuming a normal fit, compute...
MT scores: 11, 11, 16, 17, 19, 20, 21, 21 23 24 24 26 26 27...
MT scores: 11, 11, 16, 17, 19, 20, 21, 21 23 24 24 26 26 27 27 28 28 28 29 30 31 31 32 33 35 37 38 38 39 42 44 Questions for Class MT Score Distribution Analysis 1. Create a histogram of MT scores. 2. Describe the shape of the MT scores distribution. 3. Compute the mean and standard deviation. 4. Compute the 5-number summary. 5. Create a boxplot of MT scores. 6. Compute the probability that...
Please correct chosen answers if incorrect. 22) d 23) c 24) c 22) Which of the...
Please correct chosen answers if incorrect. 22) d 23) c 24) c 22) Which of the following is not true regarding event rates: a. an event can be anything such as Chicago Cubs winning the World Series b. event rates are seldom used as they only provide data of nominal significance c. event rate is statistical term that describes how often an event occurs d. the formula for event rate is the number of times the event occurs, divided by...
Resident Commuter 22 25 27 23 26 28 26 24 18 20 19 18 22 25...
Resident Commuter 22 25 27 23 26 28 26 24 18 20 19 18 22 25 24 35 25 20 26 24 27 26 18 19 23 18 23 22 28 25 20 24 18 30 26 18 18 19 32 23 26 30 22 22 22 21 18 20 19 19 18 29 19 22 18 22 19 26 35 19 19 18 19 32 26 19 19 21 23 18 20 18 29 23 21 19 36 27...
Consider the following sample data: x 22 24 27 21 23 14 14 15 y 101...
Consider the following sample data: x 22 24 27 21 23 14 14 15 y 101 139 250 88 87 14 16 20 Data is in the spreadsheet. Use Excel's Regression tool in Data Analysis to find the sample regression equation for the model: y = β0 + β1x + ε. What is the coefficient for β0 ? (Enter your answer rounded to 2 decimal places. If you got 876.36905323 for your answer, you would type 876.37)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT