Question: a) Write a Matlab script file to calculate sin(x) and cos(x), which are defined as follows: sin(x) = x - x^3/3! + x^5/5! - x^7/7!

 a) Write a Matlab script file to calculate sin(x) and cos(x),

a) Write a Matlab script file to calculate sin(x) and cos(x), which are defined as follows: sin(x) = x - x^3/3! + x^5/5! - x^7/7! + ... cos(x) = 1 - x^2/2! + x^4/4! - x^6/6! + ... Here n! is ' n factorial": n! = n middot (n - 1) middot (n - 2)... 3 middot 2 middot 1. Note that the argument x is in radians, NOT degrees! Your program should have the following features: Prompt user for x and the number of terms to include in the summation (input the values of x and n from command window) Do NOT calculate n! for each term. Recognize that for each successive term, n! for that term is n! of the previous term times (n + l) middot (n + 2). Similarly do NOT calculate x^n for each term. Recognize that each successive term for n is x from the previous term multiplied by x^2, i.e., x^n + 2 x^n x^2 Tips: Manually calculate the first several terms to verify your program is working correctly Learn to use the debugger in Matlab. It is an invaluable tool. Use the "format long" command to express your results with many digits b) use your program to compute the following: sin(0.01) and cos(0.01) using 80 terms sin(0.5) and sin(0.5) using 80 terms sin (10) and cos(10) using 80 terms c) how many terms are required to computer each of the following to 10 digits of accuracy (tip use the sin() and cos() functions in MATLAB to get the true values) sin (0.5) sin(5) sin(20) d) can sin (20) do you calculate sin(100)? can you calculate sin(0.01) using 200 terms? If not, what do you is happening

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!