There are no variables v5 through v13. The next variable to be created will be v
ID: 3807825 • Letter: T
Question
There are no variables v5 through v13. The next variable to be created will be v14.
4. Create a row vector v14 with 4 elements .
5. Create another row vector v15 that will have 5 elements such that last 4 elements are same as v14.
6. Create a column vector v16 that is the transpose of v15. Write MATLAB code to show the size of v16.
7. Create a column vector v17 that will have all elements 1 and have the same size as v16.
8. Create MATLAB variable v18 that is assigned the values 1/8, 1/16, 1/24…1/80 in that order. Use shortcut expression using colon operator.
9. Create a MATLAB variable v19 that will contain the sum of the first 5 elements of v18.
10. Use colon operator to create a MATLAB variable v20 such that v20 = [50 45 40 ……………………. -15]
11. Create a subarray v21 from array v20 such that v21= 50 45 40 35 30
12. Use input() function to accept a numerical value and assign it to v22. Use disp() function to print “ The content of variable v22 is: 12” , assuming that the user will provide 12 using keyboard input to the variable v22. Since disp() function can concatenate two strings, you may need to convert the numerical value of variable v22 into string using a suitable function.
13. Create an array v23 with size of 2 by 3. Create another array w32 with size of 3 by 2. Do matrix multiplication of v23 and w32. Assign the result to the variable z22
Explanation / Answer
v14= [1:4] %creating vector V14 with 4 elements
v15= [ 5 1 2 3 4] % all 4 elements are v14 elements
v16=transpose(v15) % v15 transpose this can be also done as v16=V15'
length(v16) %size of v16 can be derived using length() function
v17= ones(length(v16),1) % vector of all 1s whose size is same as that of v16
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.