Question: Write a Matlab script called cubes.m which declares a vector of numbers, A, and creates a new vector B containing the cubes of the positive

 Write a Matlab script called cubes.m which declares a vector of

Write a Matlab script called cubes.m which declares a vector of numbers, A, and creates a new vector B containing the cubes of the positive numbers in A. If an element is negative, put zero in the corresponding position in B. Your solution must use a loop to iterate through the vectors. The following example specifies the minimum output: Given A [1, 2,-1, 5, 6, 7,-4, 3, -2, o >cubes B= 1 8 0 125 216 343 0 27 00

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!