Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Creating row/column vectors using [], commas/spaces, and semicolons; horizontal/

ID: 3598771 • Letter: C

Question

Creating row/column vectors using [], commas/spaces, and semicolons; horizontal/vertical concatenation; transpose using apostrophe. Do the following Create the following row vector. Assign it as variable A . A=[7 49-5] *Given a scalar X (an array of size Lxl) with a random numerncal value, horizontally concatenate (join) vector A above with the given scalar X. Append X in the front and the end of the vector A. Assign the new row vector after concatenation as variable B o The value of Xitself will be randomized at each submission by the auto grader Refer to X as a variable already existed in the workspace. Do not modify X Example: if X happens to be 99, B should be, o B=[99 7 49-5 99 ] . Transpose the row vector B above, so it becomes a column vector. Assign this column vector as variable C. 49 5 10 C 49 0 789 49 5 . Create a column vector D as shown above . Vertically concatenate (join) the column vector C with itself. Assign the result as variable E Hint. Try P = [1:2:3], Q = [P: P: 10: 20; P], R = P', S = [80, 90, R, R]

Explanation / Answer

Create a row vector A

>> A = [7 49 -5] // This is a row vector, to create a column vector insert ; after each row elements [7; 49;-5]

scalar X

>> X = rand(1) // rand(n) generates nxn matrix with random entries. In this case its [99]

Concatenate A & X

B = [X, A, X] // Notice , which is used for horizontal concatenation

Tanspose

C = B.'

Create column vector

D = [10; -2; 0; 789] // Notice semicolons used to create column vector

Vertically concatenate C with C

E = [C ; C] // Here ; used for vertical concatenation

If this answers your question please give a thumb up. Good Luck!!

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote