

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


i) c = a′^ ∗ b ans. well-defined - it’s a 5 x 3 array ii) c = b′^ ∗ a ans. well-defined - it’s a 3 x 5 array iii) c = a′. ∗ b ans. not well-defined - dot multiplication requires the arrays be of the same size
exp(x) = 1 + x +
x^2 2!
x^3 3!
provide Matlab script to ask the user for a value of x and a positive integer N. Then sum the first N terms ofthe series and write out the answer as a decimal number with four digits to the right of the decimal point. answer is supplied as a separate file
[ 1 2 3 4 5; 6 7 8 9 10; 11 12 13 14 15
] describe the fol- lowing
i) a(:, 2 : 2 : 5) ans. a 3 x 2 array consisting of all rows and columns 2 and
ii) length(a(:)) ans. a(:) is a single column array consisting of all elements of a in column order. Its length is 15. iii) a(2, 3 : 5) ans. a 1 x 3 array row 2 columns 3, 4 and 5. It evaluates to 8 9 10
i) a(1, 1) > 4 ans. It’s legal and evaluates to 0 , meaning false ii) a(3, 5) > a(2, 3) ans. It’s legal and evaluates to 1 , meaning true iii) a(:, 4) > a(1, 1) ans. It’s legal. The array on the left is a 3 x 1 array consisting of the fourth column of a. The scalar a(1, 1) on the right is (implicitly) multiplied by a 3 x 1 array of ones (ones(3,1). The expression evaluates to a 3 x 1 array of ones