ENGR300 Homework 3 on MATLAM Hi,There are 6 questions in the file. Must be solved on the MATLAB program. ENGR 300 Homework 3 Please upload a PDF of your ho
ENGR300 Homework 3 on MATLAM Hi,There are 6 questions in the file. Must be solved on the MATLAB program. ENGR 300 Homework 3
Please upload a PDF of your homework including generated plots and any .m files you created.
Q1. The following infinite series can be used to approximate ex :
(a)
Prove that this Maclaurin series expansion is a special case of the Taylor series expansion
with xi = 0 and h = x.
(b)
Use the Taylor series to estimate f(x) = e−x at xi+1 = 1 for xi = 0.25. Employ the zero-,
first-, second-, and third-order versions and compute the εt for each case.
Q2. Use zero- through third-order Taylor series expansions to predict f(3) for
using a base point at x = 1. Compute the true percent relative error for each approximation.
Q3. Use a centered difference approximation of O(h2) to estimate the second derivative of the
function examined in problem 2. Perform the evaluation at x = 2 using step sizes of h = 0.2 and
0.1. Compare your estimates with the true value of the second derivative. Interpret your results
on the basis of the remainder term of the Taylor series expansion.
Q4. Consider the function f(x) = x3 − 2x + 4 on the interval [−2, 2] with h = 0.25. Use the
forward, backward, and centered finite difference approximations for the first and second
derivatives so as to graphically illustrate which approximation is most accurate. Graph all three
first-derivative finite difference approximations along with the theoretical, and do the same for
the second derivative as well.
Q5. Develop a well-structured MATLAB function to compute the Maclaurin series expansion
for the sine function as described below.
Pattern your function after the one for the exponential function below.
function [fx,ea,iter] = IterMeth(x,es,maxit)
% Maclaurin series of exponential function
% [fx,ea,iter] = IterMeth(x,es,maxit) %
input:
% x = value at which series evaluated
% es = stopping criterion (default = 0.0001) %
maxit = maximum iterations (default = 50) %
output:
% fx = estimated value
% ea = approximate relative error (%)
% iter = number of iterations
% defaults: if nargin < 2|isempty(es),es =
0.0001;end if nargin <
3|isempty(maxit),maxit = 50;end
% initialization
iter = 1; sol = 1; ea = 100;
% iterative calculation
while (1) solold = sol;
sol = sol + x ^ iter / factorial(iter); iter =
iter + 1; if sol~ = 0 ea = abs((sol −
solold)/sol)*100;
end
if ea< = es | iter> = maxit,break,end
end fx =
sol;
end
Test your program for θ = π/3 (60°) and θ = 2π + π/3 = 7π/3 (420°). Explain the difference in the
number of iterations required to obtain the correct result with the desired approximate absolute
error (εa).
Q6. Recall that the velocity of the falling parachutist can be computed by:
Use a first-order error analysis to estimate the error of v at t = 6, if g = 9.81 and m = 50 but c =
12.5 ± 1.5.
Purchase answer to see full
attachment