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

Directions: Write the numeric result of the MATLAB expression. These may be enti

ID: 3577600 • Letter: D

Question

Directions: Write the numeric result of the MATLAB expression. These may be entire vectors or matrices. Given d = [6 8 3 1 7 4] What are the result of the following MATLAB expressions? d(3) d(2:5) _ d(5: end) _ given x = [1 2 3; 4 5 6; 7 8 9; 10 11 12] what are the results of the following MATLAB expression? x(1, 2) x(3, 3) _ x(2:3, 1:2) x(3, :) _ Given v = [12 9 6 3 0] sum(v) mean(v) _ min(v) _ prod(v) Find the result of the following MATLAB expressions: 2 * [2 3 2] [1 2; 3 4] + [1 2; 1 2] [3 2] * [4 1] ______

Explanation / Answer

(46)

   d is vector with six elements. Index stars from 1 to 6

   (a) d(3) ->   Fetches the element at index 3 which is 3
  
   (b) d(2:5) -> Fetches elements starting from index 2 to index 5, results in 8 3 1 7

   (c)   d(5:end) -> Fetches elements starting from index 5 to till end index, results in 7 4
  
  
-------------------------------------------------------------------------------------------------

(47)

   x is a matrix of dimension 4 X 3 (Four rows and Three columns)
  
   (a) x(1,2) fetches the element present present at row 1, column 2. Results in 2
  
   (b) x(3,3) fetches the element present present at row 3, column 3. Results in 9
  
   (a) x(2:3,1:2) fetches the elements present present at rows 2 and 3, columns 1, 2.
      
       Results in   
           4 5
           7 8

  
   (a) x(3,:) fetches the element present present at row 3.
      
       Results in
          
           7 8 9
          
-------------------------------------------------------------------------------------------------

(48)

   v is a vector of five values
  
   (a) sum(v) will returns the sum of all elements in the vector. Output: 30
  
   (b) mean(v) will returns the average( sumOfElements / numberOfElements = 30/5) of all elements in the vector. Output: 6
  
   (c) min(v) will returns the minimum of all elements in the vector. Output: 0
  
   (d) prod(v) will returns the product of all elements in the vector. Output: 0
  
--------------------------------------------------------------------------------------------------------

(49)

   (a) 2 * [2 3 2]
  
       Multiplies every element of vector with 2.
      
       Output: [4 6 4]
      
   (b) [1 2; 3 4] + [1 2; 1 2]
  
       Adds two 2x2 matrices (Adds elements at corresponding indices) and results in another 2x2 matrix.
      
       Result: [2 4; 4 6]
      
       Output:
               2 4
               4 6

              
   (c) [3 2] .* [4 1]
  
       Multiplies the elements at corresponding indices.
      
       Output: 12 2

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