Question: This is Matlab Write a M-file script that creates a row vector that has 100 elements with dimensions of (1 times 100) and name the
This is Matlab
Write a M-file script that creates a row vector that has 100 elements with dimensions of (1 times 100) and name the vector a. The first 25 elements have of value 1, the next 25 elements have value of zero, the next 25 elements have value of 2, the next 25 elements have value of -1. Concatenate the four sub arrays into an array named a. Include the size function to determine the dimensions of the array progmanatically. Assign the variable vector_size to the size function as the output. Next using indexing include code to assign the variable a89 to equal the value of the 89th element of a. You must include comments describing your code! Your Script % create four sub vectors and then concatenate % them into a single row vector named % b1 is the first sub array % you must create the remaining three sub arrays b1 = ones (1, 25): % b2 = % b3 = % b4 = % You must assign variable a to the concatented array a = [b1 b2 b3 b4]: % your must assign the variable vector_size to a built in function to % progamattically determine the dimension of vector a vector_size =size(a) % You must assign the variable name a89 to an expression indexing the 89 element of a a89 = a(1, 89)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
