{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# HW6 - elements in a vector The cumulative product of the j...

This preview shows page 1. Sign up to view the full content.

PETE 2060 – Computing in Petroleum Engineering Homework 6 Due date 10 26 2010 Problem 1. (MATLAB) Write a script that will use the random-number generator rand to determine the number of random numbers it takes before a number between 0.8 and 0.85 occurs. Problem 2. (MATLAB) The Fibonacci numbers are computed according to the following relation: F n = F n-1 + F n-2 with F 0 = F 1 = 1. Compute the first 20 Fibonacci numbers. Problem 3. (MATLAB) Write a program which computes the cumulative product of the
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: elements in a vector. The cumulative product of the j th element of the vector x, x j , is defined by p j = (x 1 )(x 2 ) . .. (x j ) for j = 1:length of the vector x. Now write a program that uses two for-loops to explicitly carry out the calculations, element by element. An "inner" loop should accumulate the product and an "outer" loop should more through the elements of the vector p....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online