Question: X Use a for loop to fill in an array || 6 solutions submitted (max: 10) | View my solutions One of the most common

 X Use a for loop to fill in an array ||

X Use a for loop to fill in an array || 6 solutions submitted (max: 10) | View my solutions One of the most common applications of for loops in MATH 307 is to fill in the entries of an array one at a time. x = [x(1), (2), (3), ... ,x(i), ..., x(n)]; I have an array of length 250 named x with random integers from 1 to 10. Create a corresponding array where each entry is computed using the following criteria If the entry in x is less than 4, define the corresponding entry in y to be 0. If the entry in x is between 4 and 7 (inclusive), define the corresponding entry in y to be twice the entry in x. If the entry in x is greater than 7, define the corresponding entry in y to be 100. Script 1 rng(307); % so the random numbers are the same 2 x = randi(10,1,250); % random integrs from 1 to 10, of size 1x250

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!