Ask Question
29 December, 23:13

Create a row vector vA=1:3:34 that has 12 elements. Then, create a new nine-element vector vB from the elements of vA such that the first five elements are the first five elements of the vector vA, and the last four are the last four elements of the vector vA. Use the colon symbol to address a range of elements. (Do not type the elements of the vector vA explicitly.)

+2
Answers (1)
  1. 29 December, 23:16
    0
    Step-by-step explanation:

    Create a row vector vA=1:3:34 that has 12 elements.

    Matlab Code:

    vA = [1:3:34]

    Where vA = [starting element:difference:ending element]

    Ouput:

    vA = 1 4 7 10 13 16 19 22 25 28 31 34

    Create a new nine-element vector vB from the elements of vA such that the first five elements are the first five elements of the vector vA, and the last four are the last four elements of the vector vA

    Matlab Code:

    % get first five elements from vector vA

    vB1 = vA (1:5)

    % get last four elements from vector vA

    vB2 = vA (9:12)

    % combine them together to form row vector vB

    vB = [vB1, vB2] (comma or space both are fine)

    Ouput:

    vB1 = 1 4 7 10 13

    vB2 = 25 28 31 34

    vB = 1 4 7 10 13 25 28 31 34
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Create a row vector vA=1:3:34 that has 12 elements. Then, create a new nine-element vector vB from the elements of vA such that the first ...” in 📗 Mathematics if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers