Generate the first k terms in the sequence a(n) define recursively by
a(n+1)=p*a(n)+(1+a(n)) with p=0.9 and a(1)=0.5
n = 2;
a = [a(1) a(2)] = [0.5000 1.9500]
The difficulty with this problem is not generating the sequence, that is trivial, but to conform to the completely arbitrary and inaccurate rounding rules of the test suite.
Something I really want to tell the one who create this problem: base on this test suite you just made, I'm positively sure that you've learned your lesson in gym class.
Check your y_correct for x=20 for extraneous whitespace characters.
Vectorize the digits of an Integer
Set the array elements whose value is 13 to 0
Write a function man that takes a row vector v and returns a matrix H as follows..
Back to Basics - Find no. of elements in a matrix?
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office