###########Programming code############
myData = input("\Enter x and Convergence tolerance in vector
form [x,tol]: ");
x = myData(1);
tol = myData(2);
if exp(x) < 10^-6
error("The value is very small, terminating program")
end
% Zeroth term
n = 0; % Term number
result = (x^n)/factorial(n);
rel_Error = (result - exp(x))/(exp(x));
while abs(rel_Error) > tol % Repeating until
convergence
n = n+1; % Incrementing terms counter
result = result + (x^n)/factorial(n);
rel_Error = (result - exp(x))/(exp(x));
end
fprintf("\nUsing in-built function, exp(%.3f) =
%.6f",x,exp(x))
fprintf("\nUsing Series computation, exp(%.3f) = %.6f, relative
error = %.6f, Number of
terms:%d\n",x,result,abs(rel_Error),n);
% Plots
subplot(1,5,1)
xp = linspace(-3,3);
plot(xp,exp(xp))
title("e^x (Matlab Function)")
ex_1 = zeros(1,length(xp)); % Initializing all for faster
execution
ex_2 = zeros(1,length(xp));
ex_3 = zeros(1,length(xp));
ex_4 = zeros(1,length(xp));
for k = 1:length(xp) % calculating result for all xp
ex_1(k) = 1 + (xp(k)^1); % 1 term
ex_2(k) = ex_1(k) + (xp(k)^2)/ factorial(2); % 2 term
ex_3(k) = ex_2(k) + (xp(k)^3)/ factorial(3); % 3 term
ex_4(k) = ex_3(k) + (xp(k)^4)/ factorial(4); % 4 term
end
subplot(1,5,2)
plot(xp,ex_1) % Plotting 1 term approximation
title("1 term")
subplot(1,5,3)
plot(xp,ex_2) % 2 terms
title("2 terms")
subplot(1,5,4)
plot(xp,ex_3) % 3 terms
title("3 terms")
subplot(1,5,5)
plot(xp,ex_4) % 4 terms
title("4 terms")
Command Window:![Command Window Enter x and Convergence tolerance in vector form [x, tol] [2 10A-5] Using in-built function, exp (2 . 000) = 7](http://img.homeworklib.com/images/82565a49-515d-4ee6-b150-2decfe992ea1.png?x-oss-process=image/resize,w_560)

Instructions: Submit your script in a file named hwk08.m to the dropbox before 11:59 pm on the du...
Lastname, Firstname MECH 1314 Homework #12-Bisection Due: 4/22/2019 Instructions: Submit your script in a file named hwk12.m to the dropbox before 11:59 pm on the due date 20 pts The "root" of an equation, y f(x), is a value of x for which y has a value of zero and it is often "the answer" for a practical engineering problem. For example, ion Algebra you learned the Quadratic Equation, an equation that allows you to compute the value of each...
This is a matlab HW that I need the code for, if someone could
help me figure this out it would be appreciated.
The value of t can be estimated from the following equation: in your script file, estimate the value of π for any number of terms. You must ask the user for the desired number of terms and calculate the absolute error/difference between your calculation and the built-in MATLAB value ofpi. Display your results with the following message...
part 2 to the problem in matlabthis is the hint that came
with the problem
The value of T can be estimated from the following equation: In your script file, estimate the value of t for any number of terms. You must ask the user for the desired number of terms and calculate the absolute error/difference between your calculation and the built-in MATLAB value ofpi. Display your results with the following message (including the asterisks) where II is the number...
MATLAB help!
I have some MATLAB Assignment to do, the proffesor requires
all the small parts in order to get full credit. Help me out, thank
you
f LAB SECTION NAME HW6P3 (30 points) following are infinite series representations of the function, un pra i a script file HW6P3 that determines the value of the function from the sum of the series for a given value of x. The program (1 pt) must prompt the user to enter a value...
For this project, each part will be in its oun matlab script. You will be uploading a total 3 m files. Be sure to make your variable names descriptive, and add comments regularly to describe what your code is doing and hou your code aligns with the assignment 1 Iterative Methods: Conjugate Gradient In most software applications, row reduction is rarely used to solve a linear system Ar-b instead, an iterative algorithm like the one presented below is used. 1.1...