Question: QUESTION 2 : [ 3 0 ] A geometric series with n number of terms is defined as follows, where a is the first term
QUESTION : A geometric series with number of terms is defined as follows, where is the first
term of the series, and is the common ratio:
Create a local function at the end of the script named "geoseries". Assume "geoseries" function
has two outputs: all the elements in a geometric series and its sum. Your function will receive two
integer arguments. The first input specifies the initial value of the series ie a and the second input
specifies the number of terms in the series ie You should include a comment section in your script
that describes the function. For example, in the Command Window, when the function "geoseries" is
called:
output sum geoseries
output
sum
because
In vour script, test your function by writing a script that prompts the user for the input values using the
"input" function in MATLAB so that MATLAB will display the following:
Enter the initial value:
Enter the number of terms:
red text indicates what the user will enter
You should use one of the output statements discussed in the lecture to output the sum of the series:
The sum is:
You should test your function by inputting different input values to ensure that the function works properly.
Note: any MATLAB builtin functions except sum and conditional statements ifelse
statement, for and while loops are NOT allowed in this question.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
