III. Instructions Develop a function pseval implementing a Maclaurin's Series calculator and visualizer. It must have the following features: 1. Calculator Mode • It must take in a function handle f, in terms of x and n, containing the power series representation of a function, the number of terms in to be included in the computations, and a scalar value x that will be used to evaluate the function. The program must automatically execute this mode if there are exactly 3 input arguments. . The output will be a scalar value y which is the value of the evaluated function. 2. Visualizer Mode • It must take in a function handle f, in terms of x and n, containing the power series representation of a function, the number of terms n to be included in the computations, and the left and right boundaries x_1 and x_r that will be used in plotting the function. The program must automatically execute this mode if there are exactly 4 input arguments. . Using the left boundary, the right boundary, and an increment of 0.01, generate the vector x. • The output will be a vector y obtained when the function is evaluated using the vector x. Also, plot the resulting power series curve using the specified boundaries and number of terms. Take note to include the zeroth term when counting the number of terms • Label the x-axis as x and the y-axis as f(x). Also, provide a title indicating the number of terms used. . Set the limit of the horizontal axis: x_1 to x_r. Toggle the grid on. IV. Sample Output 1. Calculator Mode f = @(x,n) (-1)^n. *x.^(2*n+1)./factorial(2*n+1); y - pseval(f,5,-5) y. -0.0896 2. Visualizer Mode f@(x,n) (-1)^n. *x.^(2*n+1)./factorial (2*n+1); pseval(f, 2, -3,3);

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
III. Instructions
Develop a function pseval implementing a Maclaurin's Series calculator and visualizer. It must have the following features:
1. Calculator Mode
▪ It must take in a function handle f, in terms of x and n, containing the power series representation of a function, the number of terms n to be included in the computations, and a scalar value x that will be used to evaluate the function. The
program must automatically execute this mode if there are exactly 3 input arguments.
▪ The output will be a scalar value y which is the value of the evaluated function.
2. Visualizer Mode
▪ It must take in a function handle f, in terms of x and n, containing the power series representation of a function, the number of terms n to be included in the computations, and the left and right boundaries x_1 and x_r that will be used in
plotting the function. The program must automatically execute this mode if there are exactly 4 input arguments.
▪ Using the left boundary, the right boundary, and an increment of 0.01, generate the vector x.
▪ The output will be a vector y obtained when the function is evaluated using the vector x. Also, plot the resulting power series curve using the specified boundaries and number of terms. Take note to include the zeroth term when counting the
number of terms.
▪ Label the x-axis as x and the y-axis as f(x). Also, provide a title indicating the number of terms used.
▪ Set the limit of the horizontal axis: x_1 to x_r. Toggle the grid on.
IV. Sample Output
1. Calculator Mode
f = @(x,n) (-1)^n.*x.^(2*n+1)./factorial (2*n+1);
y = pseval(f,5,-5)
y =
-0.0896
2. Visualizer Mode
f = @(x,n) (-1)^n.*x.^(2*n+1)./factorial (2*n+1);
pseval(f, 2, -3,3);
Function >
1.5
1
0.5
0
-0.5
Maclaurin's approximation of f(x) using 2 terms.
function y = pseval(f,n, varargin)
Code to call your function >
== @(x,n) (-1)^n.*x.^(2*n+1)./factorial (2*n+1);
= pseval(f,5,-5)
pseval(f, 2, -3,3);
C Reset
MATLAB Documentation
C Reset
Transcribed Image Text:III. Instructions Develop a function pseval implementing a Maclaurin's Series calculator and visualizer. It must have the following features: 1. Calculator Mode ▪ It must take in a function handle f, in terms of x and n, containing the power series representation of a function, the number of terms n to be included in the computations, and a scalar value x that will be used to evaluate the function. The program must automatically execute this mode if there are exactly 3 input arguments. ▪ The output will be a scalar value y which is the value of the evaluated function. 2. Visualizer Mode ▪ It must take in a function handle f, in terms of x and n, containing the power series representation of a function, the number of terms n to be included in the computations, and the left and right boundaries x_1 and x_r that will be used in plotting the function. The program must automatically execute this mode if there are exactly 4 input arguments. ▪ Using the left boundary, the right boundary, and an increment of 0.01, generate the vector x. ▪ The output will be a vector y obtained when the function is evaluated using the vector x. Also, plot the resulting power series curve using the specified boundaries and number of terms. Take note to include the zeroth term when counting the number of terms. ▪ Label the x-axis as x and the y-axis as f(x). Also, provide a title indicating the number of terms used. ▪ Set the limit of the horizontal axis: x_1 to x_r. Toggle the grid on. IV. Sample Output 1. Calculator Mode f = @(x,n) (-1)^n.*x.^(2*n+1)./factorial (2*n+1); y = pseval(f,5,-5) y = -0.0896 2. Visualizer Mode f = @(x,n) (-1)^n.*x.^(2*n+1)./factorial (2*n+1); pseval(f, 2, -3,3); Function > 1.5 1 0.5 0 -0.5 Maclaurin's approximation of f(x) using 2 terms. function y = pseval(f,n, varargin) Code to call your function > == @(x,n) (-1)^n.*x.^(2*n+1)./factorial (2*n+1); = pseval(f,5,-5) pseval(f, 2, -3,3); C Reset MATLAB Documentation C Reset
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education