Ask Question
30 June, 06: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.)

+3
Answers (1)
  1. 30 June, 09:18
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers