Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help this Metlab exercises ! EXERCISE 1 Enter the following matrices and vectors in MATLAB -=[1298)-(44) --CE-14 -2 6), 1-(1) [ 2 2 -21 [

Help this Metlab exercises ! image text in transcribedimage text in transcribedimage text in transcribed

EXERCISE 1 Enter the following matrices and vectors in MATLAB -=[1298)-(44) --CE-14 -2 6), 1-(1) [ 2 2 -21 [ 13 A= 8 -4 8 , B= 12 -5 7 , b= -4 , c= -1 -2 5 , d= 4 ( 8 7 -9 || 1 -5 -1 -9 [3] (a) Perform the following operations: AB, BA, CA and Bd (use standard linear algebra multiplication). L -6 (b) Construct a 6 x 3 matrix C = and a 3 x 4 matrix D = (B d. (c) Use the "backslash" command to solve the system Ax = b. (d) Replace (1,1)-entry of the matrix A by 0. (e) Extract the 2nd row of the matrix A and store it as a vector a. (f) A row or a column of a matrix can be deleted by assigning the empty vector [] to the row or the column; (for instance A(2,:)=[] deletes the second row of the matrix A). Delete the first column of the matrix B. EXERCISE 2 Recall that a geometric sum is a sum of the form a + ar + ar+ ar3 + .... (a) Write a function file called geomsum1 which accepts the values of r, a and n (in that order) as input arguments and uses a for loop to return the sum of the first n terms of the geometric series. Test your function for r = -2/7, a = 6, n = 11. (b) Write a function file called geomsum2 which accepts the values of r, a and n (in that order) as input arguments and uses the built in command sum to find the sum of the first n terms of the geometric series. Test your function for r = -2/7, a = 6, n = 11. Hint: Start by defining the vector e = [O:n-1) and then evaluate the vector R = r. e. It should be easy to figure out how to find the sum from there. EXERCISE 3 The counter in a for or while loop can have an explicit increment: for i=m:k:n. This advances the counter i by increment k each time. In this problem we will evaluate the product of the first 7 odd numbers 1.3.5. .... 13 in two ways: (a) Write a script file that evaluates the product of the first 7 odd numbers using a for loop. (b) Evaluate the product of the first 7 odd numbers using a single MATLAB command. Use the MATLAB command prod. while loop The while loop repeats a sequence of commands as long as some condition is met. The basic structure of a while loop is the following: while end Here are some examples: Determine the sum of the inverses of squares of integers from 1 until the inverse of the integer square becomes less than 10-10: + +...+ while > 10-10. S = 0; % initialize running sum k = 1; % initialize current integer incr = 1; % initialize test value while incr>=1e-10 S = S+incr; k = k +1; incr = 1/k*2; end What is the value of S returned by this script? Compare to 1 2 R2 2 6 Create a row vector y that contains all the factorials below 2000: y = ( 1!, 2, 3, ...k! ] while k!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Excel caculation on cascade mental health clinic

Answered: 1 week ago

Question

a. How do you think these stereotypes developed?

Answered: 1 week ago

Question

7. Describe phases of multicultural identity development.

Answered: 1 week ago