Question: Can you please give a Matlab code for this problem. Thanks! (1) Write a script file named sineseries.m that computes the value of sin(x) at
(1) Write a script file named sineseries.m that computes the value of sin(x) at a given x using n terms of the series expansion of the sine function: 2k-1 sin(x)= x-x, + 51-... (-1)k-1 (2k -1)! Save the file. Type help sineseries to see if MATLB can access your script file. Now compute sin( pi/6) with n-1,5,10,20. Compare the results. Do the same for some other x of your choice. (2) Take the script file in problem (1) and convert it into a function file, using x and n to be inputs, and y as the output. Call the function as sine series, and run it for n-1, 5, 10, 20 and x=pi/6. Do the same for other x of your choice
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
