Iterate through vector a using a for loop and create a new


Question: Use either a for or while loop.

Part 1: Iterate through vector A using a for loop and create a new vector B containing logical values. The new vector should contain true for positive values and false for all other values.

Part 2: Same as part A excpet use a while loop

Part 3: Iterate through a logical array N using a for loop and return a new vector M containing the value 2 wherever an element of N is true and a -1 where N is false

Part 4: Iterate through an array z using a while loop. Replace every element with number 3 until you reach a value larger than 50. Leave the rest unchanged.

Comment the code, determine the form of the output depended on the coefficients being input.

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Iterate through vector a using a for loop and create a new
Reference No:- TGS0957051

Expected delivery within 24 Hours