clc;
clear;
close all;
x = 2;
k = 1;
sum = 0;
while (k <= 5)
sum = sum + (-1)^(k-1)*(x^(2*(k-1)))/factorial(2*(k-1));
k = k+1;
end
val = cos(2);
fprintf('Using the Maclaurin series cos(2.0) with 5 terms is %0.4f
\n',sum);
fprintf('The value of cos(x) using the built-in cos function is
%0.4f \n',val);


In MATLAB The value of cos(x) can be approximated using a Maclaurin series + +... cos(x)=1-1...
Convince yourself that the Maclaurin Series for cos(x) is:
A. Write a function script called cos_series
that takes that takes as its inputs, x and N and has output given
by the sum in the N-term Maclaurin Series approximation for Cos(x).
Hint: try a “for loop” and set “format long” in
your code. You may use the MATLAB built-in function factorial()
B. Check your code by finding the 2-terms,
3-terms, 4-terms, 5-terms and 6-terms Maclaurin Series
approximations every 30 degrees...
I want to create a Matlab function of the maclaurin series of cos(x), which depends on x and tol, and plot the function for -Lx<=x<=Lx where Lx is a user specified input.
MATLAB
Use the Taylor series cos(x)-1-to compute cos(x) to four decimal places (by comparing the value with the matlab built-in function for cos). How many iterations does it take to get to 4- decimal place agreement? (hint: help factorial) 2! 4! 6!
Use a Maclaurin series in the table below to obtain the Maclaurin series for the given function. f(x) = 5 cos( ) Š f(x) n = 0 T-sr x" = 1 + x + x2 + x + ... R=1 x x et = 1 + + + + R = 00 1! 2! 3! 20+1 sin x= (-1)" (2n + 1)! = X- + +... R=00 3! 5! 7! 2 r+ COS X = + — +... R= 00...
Find the terms through x° in the Maclaurin series for f(x). cos (3x) -1+x2 f(x) = = 81x4 What is the Maclaurin series? 0A ਕ ਉਹ ' ਕੌਰ -- ਦੀ ਕੀਤੀ ਸੀ | 00. ਕ + ਖੇਹ ' ਚ '
Use a Maclaurin series in the table below to obtain the Maclaurin series for the given function. f(x) = 2 cos( - Śr-1+r R - 1 R-00 R- R-00 sin x - Žr-"* )---+--+... cos x= -1- -1- -... ton's - Ž<--*--- -... (1 +"-().-1+2+4* + – 1968 – 2x+ R-1 .. R-1
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...
THIS IS USING MATLAB
1. The value of a can be approximated by: a. Write a script which asks the user to input the number of iterations (n), then computes the expression, using a for loop to compute the summation with the specified number of iterations. The larger the number of iterations, the closer the result should be to it. Print out the value of n, and the result using fprintf with 8 digits after the decimal to see the...
Find the Maclaurin series for f(x) using the definition of a
Maclaurin series. (Assume that f has a power series expansion
f(x) = cos x
Find the Taylor series for f centered at 4 if f(n) (4) = (-1)" n! 3" (n + 1) What is the radius of convergence of the Taylor series?
find the series using the maclaurin series for e^x, sinx, and
cosx
e - cos(x) -isin(ix)
e - cos(x) -isin(ix)