Question 6a. Please use matlabObjectives: Write a convergent algorithm using Taylorseries and use global variablesFor Taylor Series. Study the series to see how it converges. Notethatfor these Trig functions, Taylor converges quickly. The number ofterms will vary based on the size of the angle and thesize of epsilon.For this program you will write a script and two functions, sineand cosine using Taylor series (NOTE: you can use anyname except the Matlab function names sin and cos for thesefunctions). Refer to ME1101 Taylor Series DOC. Thepurpose of this program is to test your sine and cosine function toinsure it solves for sin and cos accurately.CONCEPTS:You are to use three global variables k, csine, and ccosine. k isto affect epsilon [epsilon (or e if you like) should equal10^ - k.].You will use k to improve the accuracy of your functions sine andcosine compared to Matlab’s sin and cos so that yourfunction’s results match closely the Matlab sin and cosfunctions.You will use csine as a counter for your sine function and ccosineas a counter for your cosine function. the variablescsine and ccosine will be used to count how any cycles your sineand cosine functions require to converge to an accurateanswer. Your results of Sine and Cosine, k, and csine for Sine andccosine for Cosine will be recorded in the Excel sheetTEST TAYLOR.Requirements:1. Write a Script that cycles until user stops it.2. Ask the user to input k a global variable in the script, k willthen be used in both of your 2 functions. Epsilon ineach function will be 10^-k. So, by increasing k you will beimproving the accuracy of your functions.3. Ask the user for an angle in radians.4. Using the angle the user entered, call both your sine and cosinefunction, as well as the Matlab sin and cosfunctions with the same angle. Compare the results for a range ofangles between 0 and π. Pick at least 4different angles across this range. Adjust your input of k untilyou get answers close to the Matlab functions.5. Write your two functions for sine and cosine using Taylorseries.(Optional): 6. Fill in the Excel sheet TEST TAYLOR in the Labassignment in Blackboard.

ZBRRJF The Asker · Computer Science

6a. Please use matlab

Objectives: Write a convergent algorithm using Taylor series and use global variables
For Taylor Series. Study the series to see how it converges. Note that
for these Trig functions, Taylor converges quickly. The number of terms will vary based on the size of the angle and the
size of epsilon.

For this program you will write a script and two functions, sine and cosine using Taylor series (NOTE: you can use any
name except the Matlab function names sin and cos for these functions). Refer to ME1101 Taylor Series DOC. The
purpose of this program is to test your sine and cosine function to insure it solves for sin and cos accurately.
CONCEPTS:
You are to use three global variables k, csine, and ccosine. k is to affect epsilon [epsilon (or e if you like) should equal
10^ - k.].
You will use k to improve the accuracy of your functions sine and cosine compared to Matlab’s sin and cos so that your
function’s results match closely the Matlab sin and cos functions.
You will use csine as a counter for your sine function and ccosine as a counter for your cosine function. the variables
csine and ccosine will be used to count how any cycles your sine and cosine functions require to converge to an accurate
answer. Your results of Sine and Cosine, k, and csine for Sine and ccosine for Cosine will be recorded in the Excel sheet
TEST TAYLOR.
Requirements:
1. Write a Script that cycles until user stops it.
2. Ask the user to input k a global variable in the script, k will then be used in both of your 2 functions. Epsilon in
each function will be 10^-k. So, by increasing k you will be improving the accuracy of your functions.
3. Ask the user for an angle in radians.
4. Using the angle the user entered, call both your sine and cosine function, as well as the Matlab sin and cos
functions with the same angle. Compare the results for a range of angles between 0 and π. Pick at least 4
different angles across this range. Adjust your input of k until you get answers close to the Matlab functions.
5. Write your two functions for sine and cosine using Taylor series.
(Optional): 6. Fill in the Excel sheet TEST TAYLOR in the Lab assignment in Blackboard.

More
Community Answer
KNJ5WN

SOLUTION- I have solve the problem in Matlab code with comments  for easy understanding :) CODE- Tylor_series.m: warning off; while (1) %read k value from the user in = inputdlg('Enter k angle in degrees: ','Input',[1 40]); %user dialog buttons choice = questdlg('Select the sine, cosine, or sinh', ... 'Dialog buttons','sine','cosine','sinh','stop'); % Handle response k = str2num(in{1}); %convverting fron degree to radian r = k * pi/180; %check the user choice switch choice case 'sine' %call function Tylor_series_sine T = Tylor_series_sine(r); %call Trig sin funcion for comparision s = sin(r); fprintf('Tylor_series_sine = %1.4f ',T) fprintf('and Trig sine = %1.4fn',s); case 'cosine' %call function Tylor_series_sinh T = Tylor_series_cosine(r); %call Trig cos funcion for comparision s = cos(r); fprintf('Tylor series coine = %1.4f ',T) fprintf('and Trig cos = %1.4fn', s); case 'sinh' %call function Tylor_series_sinh T = Tylor_series_sinh(r); %call Trig sinh funcion for comparision s = sinh(r); fprintf('Tylor series sinh = %1.4f ',T); fprintf('and Trig sinh = %1.4fn', s); end %user dialog for Stop choice = questdlg('Do you want to ... See the full answer