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

Simple Matlab questions. You do not need a matlab to answer this. 1) (a) Write a

ID: 3569764 • Letter: S

Question

Simple Matlab questions. You do not need a matlab to answer this.

1) (a) Write a Matlab code fragment to create a vector x with elements starting at 400 and ending with -200 in decrements of 10.

(b) Write a Matlab code fragment to create a new vector y from the vector x created above but with contains absolute value of each element x.

2. Consider the matrix created by Matlab command: x=[1 4 8 7; 2 4 3 7; 4 7 8 9]

(a) What is transpose of x?

(b) Write matlab commands to extract the first 2 elements of the first row of x store in a new variable called z.

(c) Write a matlab code to extract the first and last row of x and store in a variable called z.

Explanation / Answer

1) (a) Write a Matlab code fragment to create a vector x with elements starting at 400 and ending with -200 in decrements of 10.

x = [400:-10:-200];

(b) Write a Matlab code fragment to create a new vector y from the vector x created above but with contains absolute value of each element x.

y = abs(x);

2. Consider the matrix created by Matlab command: x=[1 4 8 7; 2 4 3 7; 4 7 8 9]

(a) What is transpose of x?

x'

(b) Write matlab commands to extract the first 2 elements of the first row of x store in a new variable called z.

z = x(1,1:2)

(c) Write a matlab code to extract the first and last row of x and store in a variable called z.

z = [x(1,:); x(end,:)]

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