thanks for the help! The power series of sin x is sinx=x-x3/3!+x5/5!-x7/7!+....
ID: 1855332 • Letter: T
Question
thanks for the help!
The power series of sin x is sinx=x-x3/3!+x5/5!-x7/7!+.... This Matlab function uses the series to compute sin x This Matlab function uses the series to compute sin x function 8 = powersin(x) X POWERS IN. Power series for sin(x). X POWERSIN(x) tries to conpute sin(x) X from a power series s = 0; t = x; n = 1; while s + t =s; 8 = 8 + t; t = -x.-2/((n+1)*(n+2)). *t; n = n + 2; end What causes the while loop to terminate? Answer the following question for x = Pi/2, 21pi/2. 21pi/2. and 31pi/2:Explanation / Answer
ANSWER NO.1:
breakterminates the execution of afororwhileloop. Statements in the loop that appear after thebreakstatement are not executed.
In nested loops,breakexits only from the loop in which it occurs. Control passes to the statement that follows theendof that loop.
The example below shows awhileloop that reads the contents of the filefft.minto a MATLAB character array. Abreakstatement is used to exit thewhileloop when the first empty line is encountered. The resulting character array contains the command line help for thefftprogram.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.