Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started