Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Sequence to SQRT ( 2 ) ( for loop and vector generation ) My Solutions > Consider the sequence I f , 3 2 ,
Sequence to SQRTfor loop and vector generation
My Solutions
Consider the sequence
dots
defined by
for dots,
The sequence converges on as increases.
Code has already been provided to define a function named sequenceToSqrt that accepts a single input variable that will be an integer. Add commands to the function to do the following and assign the results to the indicated output variable names.
Generate a row vector containing the first terms of the sequence and assign to the variable terms.
Generate a scalar variable that is the relative error, between the last term in the sequence and given by the formula below the vertical bars indicate an absolute value. Assign this error result to the variable relError.
Your solution to this problem should use a for loop.
Note the value of the variable is defined as an input to the function. Do not overwrite this value in your code. Be sure to assign a value to each of the output variables.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started