Question: Write a MATLAB program that will perform the following operations on a 1D array of data v. Make sure to preallocate space for all your

Write a MATLAB program that will perform the following operations on a 1D array of data v. Make sure to preallocate space for all your resulting arrays. Create the array v = [-13.5 2.5 -32.0 45.0 -23.0 4.25 0.0 0.85 10.0 -1.5] using direct entry. Using iteration (for loop), iterate over the indices of the array v and create a new array vNew whose values are the corresponding values in v divided by two times the index of the element, for example vNew (1) = v(1)/(2*1); Using iteration (for loop), iterate over the values of the array v and create a new array vMagSqrt whose values are the square root of the magnitude (absolute value) of the corresponding values in v. Using iteration (for loop), iterate over the indices of the array v and create a new array boolvGTZ whose values are true if the corresponding value of v is positive (zero or greater) and false otherwise. MATLAB's built in false function can be used similar to the zeros function to create an array of false values (Boolean/logical 0s)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
