error=1; %starting value for error
maclaurin_value=0; % starting value for value calculated from maclaurin series
n=0; %starting power
x=2; %power to which e has to be raised to
i=0; %iteration number
while error > 0.01
i=i+1; %increment iteration number
maclaurin_value=maclaurin_value+ (x^n)/factorial(n); %calculate approximation
error=abs(exp(2)-maclaurin_value); %calculate error
fprintf("iter = %d",i);
fprintf(", approx = %f",maclaurin_value);
fprintf(", error = %f \n",error);
n=n+1; %increment exponent to get the next term in the maclaurin series
end
fprintf("exact value = %f",exp(2));
Output of this script

2. The second question refers to a program which is not included in the question. Please include the program which is (according to the question) available on the previous page.
THE CODE NEEDS TO BE ON MATLAB 2. Exercise (a) Let's write a script file that...
MATLAB ONLY!! PLEASE WRITE IN COMPUTER SO I CAN COPY
PASTE!!! ANSWER COMPLETELY, USE FOR LOOPS.
THE PROGRAM TO BE MODIFIED IS THE NEXT ONE:
clc
clear
% Approximate the value of e ^ x using the Taylor Series
x = input( 'Enter the value of x for e^x. x = ' );
t = input( 'Enter the amount of desired terms. t = ' );
i = 1;
e_taylor = 0; % initializing the variable for the
accumulator
while...
% Bisection.m Lines of code 17-26 and 43-47 are bold
% This code finds the root of a function f(x) in the interval
[a, b] using the Bisection method
%
% It uses f.m to define f(x), and assumes f(x) is continuous
% It requires specification of a, b and the maximum error
% It defines error using |f(xnew)|
% Define inputs for problem
a=0; %Defines lower limit of initial bracketing interval
b=1; %Defines upper limit of initial bracketing interval...
Write a MATLAB script file that will sum all the positive entries in V and stop summing once the sum reaches or exceeds 20(while loop). An fprintf statement should be used to display the value for the sum to prove it has reached or exceeded 20, and the number of entries to reach this value should be displayed. V = [7 9 -8 9 3 -8 -5 1 10 10 0 -7] Reminder: don’t use the built-in function, sum. Use...
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...
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...
matlab help plz
Overview: In this exercise, you will write code to compare how two different mumerical methods (a middle Riemann sum, and MATLAB's integral function) evaluate the function fx) and the x-axis. The code should output the error between the two calculated areas. area between a Function Inputs Func- the function to be numerically integrated. a-the lower interval value. b-the upper interval value. N-the number of rectangles to be used. Function Outputs: Area Riemann- the numerical approximation for the...
Matlab Question Only do parts c, d, and g. Parts a and b are for reference. This is a Matlab Question (Multipart-I already got someone to do a and b but they said I need to use another one of my questions to get c,d and g answered). The Maclaurin series expansion for e^x is e^x=1 + x/1! + x^2/2! + x^3/3! +x^4/4!... and it can be expressed in summation form as e^x = x^(k-1)/((k-1)!) The MATLAB function [exVal]=findEX(x,n) shown...
Write VBA functions to calculate sin (x) using the Maclaurin arcsine series, and compare the values for sin-1(x) from your program to those given by the Excel spreadsheet function ASIN(x). The Maclaurin arcsine expansion is given by x 3x 6 40 (2n)! sin1(x)-2((2n+1) Note: This function by definition is only defined for-1 SxS1. When you write the code for calculating it, you will need to include code that assigns a value to it that reflects it is undefined for values...
I have all of the answers to this can someone just actually
explain this matlab code and the results to me so i can get a
better understanding?
b)
(c) and (d)
%% Matlab code %%
clc;
close all;
clear all;
format long;
f=@(t,y)y*(1-y);
y(1)=0.01;
%%%% Exact solution
[t1 y1]=ode45(f,[0 9],y(1));
figure;
plot(t1,y1,'*');
hold on
% Eular therom
M=[32 64 128];
T=9;
fprintf(' M Max error \n' );
for n=1:length(M)
k=T/M(n);
t=0:k:T;
for h=1:length(t)-1
y(h+1)=y(h)+k*f(t(h),y(h));
end
plot(t,y);
hold on
%%%...