Question

In: Computer Science

z = [ 100 93 90 89 80 79 78 75 67 60 45 42 41...

z = [ 100 93 90 89 80 79 78 75 67 60 45 42 41 40 30 20 15 12 10 9 2 1]

Using MATLAB, Write fully vectorized code (no loops) to find index number of which the numbers have decreased by 40. Print results to command window.

Solutions

Expert Solution

MATLAB Code:

% MATLAB fully vectorized code (no loops) to find index number of which the numbers have decreased by 40.

% Initializing vector
z = [ 100 93 90 89 80 79 78 75 67 60 45 42 41 40 30 20 15 12 10 9 2 1];

% Storing index values
indices = 1:length(z);

% Finding index of elements that are decreased by 40
idxLess40 = indices(z < 40);

% Printing to command window
disp(idxLess40);

_____________________________________________________________________________________________________

Sample Run:


Related Solutions

82, 72, 83, 75, 80, 78, 82, 73, 60, 79, 80, 78, 83, 81 what is...
82, 72, 83, 75, 80, 78, 82, 73, 60, 79, 80, 78, 83, 81 what is the Q1, median, Q3 and the IQR with any outliers
EX1 EX2 Ex3 FINAL 73 80 75 152 93 88 93 185 89 91 90 180...
EX1 EX2 Ex3 FINAL 73 80 75 152 93 88 93 185 89 91 90 180 96 98 100 196 73 66 70 142 53 46 55 101 69 74 77 149 47 56 60 115 87 79 90 175 79 70 88 164 69 70 73 141 70 65 74 141 93 95 91 184 79 80 73 152 70 73 78 148 93 89 96 192 78 75 68 147 81 90 93 183 88 92 86 177...
46 42 37 52 58 36 75 72 90 65 78 80 56 40 48 60...
46 42 37 52 58 36 75 72 90 65 78 80 56 40 48 60 58 76 82 75 38 48 86 88 75 65 45 80 68 47 62 75 56 85 44 70 75 64 67 72 For the data set distribution of Salaries of the employees                                               Arrange in an array (ascending order) Evaluate the mean, the median, the mode, the skew, the average deviation the standard deviation and the interquartile range. Group, on a new...
Given the data set below 25 52 67 23 78 89 57 90 32 77 45...
Given the data set below 25 52 67 23 78 89 57 90 32 77 45 48 62 54 94 69 46 79 40 33 21 57 84 54 23 34 68 63 61 76 87 78 39 50 70 60 32 65 73 45 28 82 66 79 71 80 46 66 24 90 A)What is the probability of an impossible even? B) What is the probability of a certain event? C) find the approximate mean using the Frequency...
Construct a frequency polygon for the following: 60-69   12 70-79   15 80-89    10 90-99      2 100-109...
Construct a frequency polygon for the following: 60-69   12 70-79   15 80-89    10 90-99      2 100-109 1 110-119   0 120-129   1
93 95 93 81 88 88 84 75 89 81 92 91 83 78 88 77...
93 95 93 81 88 88 84 75 89 81 92 91 83 78 88 77 95 94 90 94 80 84 95 87 92 92 94 84 83 89 84 87 78 99 97 79 93 83 76 92 96 77 52 89 95 76 87 92 80 70 94 90 93 83 88 89 95 87 88 96 92 87 96 93 96 81 93 76 78 96 96 84 89 91 92 87 91 90 86 88...
Permissive Authoritative Authoritarian 70 70 55 90 80 80 90 90 75 90 70 67 M=85...
Permissive Authoritative Authoritarian 70 70 55 90 80 80 90 90 75 90 70 67 M=85 75 50 M=81 63 65 M=65 grand mean=75 Calculate your F ratio. [ If you could not answer any of the questions above about the SS and df values, go back now and make up numbers to fill in for those values then use those wrong numbers to find this F ratio. Those will be wrong, but this could be right based on those...
Grade 50 70 47 75 82 79 79 88 81 45 90 81 Time Spent (Hrs)...
Grade 50 70 47 75 82 79 79 88 81 45 90 81 Time Spent (Hrs) 166 76 30 100 100 62 9 17 13 29 1 29 a. Create a scatterplot b. what is the correlation, slope and y-intercept? c. Using your regression equation make a prediction of the grade earned if a student spent three hours completing the exercise d. how confident are you in this prediction?
For the following data 86 84 91 75 78 80 74 75 87 76 82 90...
For the following data 86 84 91 75 78 80 74 75 87 76 82 90 98   68 What is the mean?    ______ What is the median?_________ What is the mode (if any)? _____ What is the standard deviation? ____ What is the variance? ______ What is the five-number summary for this data? Draw a boxplot with reasonable attention to scale. Create a stemplot of this data. Using the same data set and ignoring the fact that the 5-number summary...
25 49 66 44 60 36 51 78 41 54 32 54 80 56 48 41...
25 49 66 44 60 36 51 78 41 54 32 54 80 56 48 41 65 64 62 53 47 72 39 69 44 1) Average 2) Medium 3) Q1 4) Q3 5) P63 6) P93 7) Range 8) Variance 9) Standard Deviation 10) Construct a box-mustache graph for the above data.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT