Taylor series of sinx using matlab, for three approx function project_2_abc () %
ID: 3871850 • Letter: T
Question
Taylor series of sinx using matlab, for three approx function project_2_abc () % PROJECT_2_ABC project_2_ABC() evaluates approximations of sin(x) % using the Taylor series expansion. % % Name: % Date: % CMPSC 200 % % % % Splash Screen fprintf('Name ): fprintf('CMPSC 200 '): fprintf('7 September 2017 '): fprintf (' ') % Description of the program fprintf(''): fprintf (''): fprintf (' ') % Have the user enter the angle % calculate the sine and the three Taylor series approximations % Store each of these in their own variable % Calculate the Percent Error of the four calculations % Store each of these in their own variable % Print the Results as a table using fprintfExplanation / Answer
please use the below code with the comments mentioned to get the desired result
clear
clc
n = input('Enter number of iterations (n): ' );
x = pi/3;
z = zeros(1,n);
for i = 0:n
z(i+1) = (-1)^i*x^(2*i+1)/factorial(2*i+1);
end
SINx = sum(z);
fprintf(" sinx value",SINx);
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.