dreawongdga
05.10.2019 •
Engineering
Select the best steel alloy for a corrosion resistant sheet metal parts. strength is not critical, but low cost is important. (a)-sae 3122 (b)-sae 2052 (c)-sae 3114 (d)-sae 9303 (e)-sae 6112
Solved
Show answers
More tips
- A Art and Culture How to Learn Screaming: Step-by-Step Guide for Beginners...
- H Health and Medicine Contraceptive Pills After 35: The Importance Of Choosing The Right Medication...
- C Computers and Internet How to Choose a Monitor?...
- H Horoscopes, Magic, Divination Where Did Tarot Cards Come From?...
- S Style and Beauty How to Make Your Lips Fuller? Ideas and Tips for Beautiful Lips...
- C Computers and Internet How to Learn to Type Fast?...
- A Art and Culture Who Said The Less We Love a Woman, the More She Likes Us ?...
- F Family and Home How to Get Rid of Your Neighbors?...
- S Society and Politics How Could Nobody Know About the Dead Mountaineers?...
Answers on questions: Engineering
- H Health Hardest behavior mod technique to implement & understand...
- E English According to o callahan, what are the three parts of a story?...
- E English Which of these is an advantage of multicellular organisms? a. they can reproduce slower than unicellular organisms b.they remain small. c. cells are able to provide support...
- H History Which of the following elements was not common to farming in the feudal system? a) enclosure of lands b) inefficient land use c) subsistence farming d) common pastures...
Ответ:
clc;clear;
isLooping = 1;
x = [];
while isLooping
newVal = input("Enter a new value or a negative number to exit loop: ", 's');
newVal=str2num(newVal)
if newVal >= 0
x = [x, newVal];
else isLooping = 0;
end
end
A = x(x>= 90);
B = x(x>= 80 & x<90);
C = x(x>= 70 & x<80);
D = x(x>= 60 & x<70);
F = x(x<60);
sprintf("There are %d elements in A", numel(A))
sprintf("There are %d elements in B", numel(B))
sprintf("There are %d elements in C", numel(C))
sprintf("There are %d elements in D", numel(D))
sprintf("There are %d elements in F", numel(F))
sprintf("The maximum grade is %d", max(X))
sprintf("The minimum grade is %d", min(X))
sprintf("The average grade is %f", mean(X))
Explanation:
The first line clears the workplace, just in case. Then, you defined a variable that will decide if we have to loop or not, and we initialize the grades array as null.
while the lopping flag is on, we ask for a new value, convert it to number, and we check: if it's greater than zero we append it to the grades array, otherise we switch the looping flag off.
At this point, the grades array is filled, and we can compute the required values. To determine the range, we can use a feature in matlab: the line
x>10
will return the positions of the elements in x that are greater than 10. So, if we use that line as a selector:
x(x>10)
we will fetch the actual elements. Using this feature, we can easily fill the range arrays A, B, C, D and F.
Finally, the number of elements in a vector is given by the numel() function, and the max, min and average are given by the built-in functions max, min and mean.